1 23 24 package org.infoglue.cms.controllers.kernel.impl.simple; 25 26 import java.sql.ResultSet ; 27 28 import org.infoglue.cms.util.ChangeNotificationController; 29 import org.infoglue.cms.util.NotificationMessage; 30 31 32 114 public class ReplicationMySqlController { 116 public static void updateSlaveServer() throws Exception 117 { 118 String bin_log = ""; 119 Integer position = new Integer (0); 120 121 MysqlJDBCService mySql = new MysqlJDBCService(); 123 124 if(mySql.isEnabled()) 126 { 127 ResultSet res = mySql.executeMasterSQL("SHOW MASTER STATUS"); 128 if (res.first()) 129 { 130 bin_log = res.getString("File"); 131 position = new Integer (res.getInt("Position")); 132 mySql.executeSlaveSQL("SELECT MASTER_POS_WAIT('" + bin_log + "', " + position + ")"); 134 } 136 137 mySql.closeMaster(); 138 mySql.closeSlave(); 139 140 NotificationMessage notificationMessage = new NotificationMessage("ReplicationMySqlController.updateSlaveServer():", NotificationMessage.PUBLISHING_TEXT, "Editor - name unknown", NotificationMessage.PUBLISHING, new Integer (-1), ""); 142 ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage); 143 } 144 } 145 } 146 | Popular Tags |