java.lang.Object
com.aoindustries.aoserv.master.ClusterHandler
- All Implemented Interfaces:
CronJob
The
ClusterHandler maintains a mapping of virtual servers
to physical servers. It updates its mapping every minute.- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.aoapps.cron.CronJob
CronJob.Executor, CronJob.ScheduleMode -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckClusterAdmin(DatabaseConnection conn, RequestSource source, String action) static intgetPrimaryPhysicalServer(int virtualServer) Gets the id of the physical server that is currently the primary for the virtual server.static intgetPrimaryPhysicalServer(DatabaseConnection conn, RequestSource source, int virtualServer) static intgetSecondaryPhysicalServer(int virtualServer) Gets the id of the physical server that is currently the secondary for the virtual server.static intgetSecondaryPhysicalServer(DatabaseConnection conn, RequestSource source, int virtualServer) intstatic booleanisClusterAdmin(DatabaseConnection conn, RequestSource source) voidrun(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int year) static voidstart()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.aoapps.cron.CronJob
getExecutor, getName, getScheduleMode
-
Method Details
-
start
public static void start() -
getSchedule
- Specified by:
getSchedulein interfaceCronJob
-
getThreadPriority
public int getThreadPriority()- Specified by:
getThreadPriorityin interfaceCronJob
-
run
public void run(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int year) -
getPrimaryPhysicalServer
public static int getPrimaryPhysicalServer(DatabaseConnection conn, RequestSource source, int virtualServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getPrimaryPhysicalServer
public static int getPrimaryPhysicalServer(int virtualServer) throws ClusterHandler.ClusterException Gets the id of the physical server that is currently the primary for the virtual server. If there is no primary (Secondary/Secondary role), will use the physical server that has Xen auto start configured.- Throws:
ClusterHandler.ClusterException
-
getSecondaryPhysicalServer
public static int getSecondaryPhysicalServer(DatabaseConnection conn, RequestSource source, int virtualServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getSecondaryPhysicalServer
public static int getSecondaryPhysicalServer(int virtualServer) throws ClusterHandler.ClusterException Gets the id of the physical server that is currently the secondary for the virtual server. If there are two secondaries (Secondary/Secondary role), will use the physical server that does not have Xen auto start configured.- Throws:
ClusterHandler.ClusterException
-
isClusterAdmin
public static boolean isClusterAdmin(DatabaseConnection conn, RequestSource source) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkClusterAdmin
public static void checkClusterAdmin(DatabaseConnection conn, RequestSource source, String action) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
