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 classes/interfaces inherited from interface com.aoapps.cron.CronJob
CronJob.Executor, CronJob.ScheduleMode
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkClusterAdmin
(DatabaseConnection conn, RequestSource source, String action) static int
getPrimaryPhysicalServer
(int virtualServer) Gets the id of the physical server that is currently the primary for the virtual server.static int
getPrimaryPhysicalServer
(DatabaseConnection conn, RequestSource source, int virtualServer) static int
getSecondaryPhysicalServer
(int virtualServer) Gets the id of the physical server that is currently the secondary for the virtual server.static int
getSecondaryPhysicalServer
(DatabaseConnection conn, RequestSource source, int virtualServer) int
static boolean
isClusterAdmin
(DatabaseConnection conn, RequestSource source) void
run
(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int year) static void
start()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aoapps.cron.CronJob
getExecutor, getName, getScheduleMode
-
Method Details
-
start
public static void start() -
getSchedule
- Specified by:
getSchedule
in interfaceCronJob
-
getThreadPriority
public int getThreadPriority()- Specified by:
getThreadPriority
in 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:
IOException
SQLException
-
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:
IOException
SQLException
-
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:
IOException
SQLException
-
checkClusterAdmin
public static void checkClusterAdmin(DatabaseConnection conn, RequestSource source, String action) throws IOException, SQLException - Throws:
IOException
SQLException
-