public static java.lang.String getServerIdInstance() { org.sakaiproject.component.api.ServerConfigurationService service = getInstance(); if (service == null) return null; return service.getServerIdInstance(); }
@ManagedAttribute(description="Sakai server id instance", currencyTimeLimit=600) public String getServerIdInstance() { return serverConfigurationService.getServerIdInstance(); }
/** * Stop the maintenance thread, removing this app server's registration from the cluster table. */ public void stop() { if (m_maintenanceChecker != null) { m_maintenanceCheckerStop = true; m_maintenanceChecker.interrupt(); try { // wait for it to die m_maintenanceChecker.join(); } catch (InterruptedException ignore) { } m_maintenanceChecker = null; } // close our entry from the database - delete the record String statement = clusterServiceSql.getDeleteServerSql(); Object fields[] = new Object[1]; fields[0] = m_serverConfigurationService.getServerIdInstance(); boolean ok = m_sqlService.dbWrite(statement, fields); if (!ok) { log.warn("stop(): dbWrite failed: " + statement); } }
/** * Start the maintenance thread, registering this app server in the cluster table. */ public void start() { if (m_maintenanceChecker != null) return; // register in the cluster table String statement = clusterServiceSql.getInsertServerSql(); Object fields[] = new Object[3]; fields[0] = m_serverConfigurationService.getServerIdInstance(); fields[1] = Status.STARTING.toString(); fields[2] = m_serverConfigurationService.getServerId(); boolean ok = m_sqlService.dbWrite(statement, fields); if (!ok) { log.warn("start(): dbWrite failed"); } m_maintenanceChecker = new Thread(this, "SakaiClusterService.Maintenance"); m_maintenanceChecker.setDaemon(true); m_maintenanceCheckerStop = false; m_maintenanceChecker.start(); }
returnValue = (T) serverConfigurationService.getPortalUrl(); } else if (SETTING_SERVER_ID.equals(settingName)) { returnValue = (T) serverConfigurationService.getServerIdInstance(); } else { if (defaultValue == null) {
@Override public void update(Observable o, Object arg) { if (arg instanceof Event) { Event event = ((Event) arg); // We don't actually if (m_serverConfigurationService.getServerIdInstance().equals(event.getResource())) { if (EVENT_CLOSE.equals(event.getEvent())) { changeStatus(Status.CLOSING); } else if (EVENT_RUN.equals(event.getEvent())) { changeStatus(Status.RUNNING); } } else { log.debug("Ignoring message for other node."); } } } }
returnValue = (T) serverConfigurationService.getPortalUrl(); } else if (SETTING_SERVER_ID.equals(settingName)) { returnValue = (T) serverConfigurationService.getServerIdInstance(); } else { if (defaultValue == null) {
/** * Writes an event to cache, if enabled * * @param event the event object * @param eventId the id of the event object */ private void writeEventToCluster(Event event, Long eventId) { if (cachingEnabled) { if (eventCache != null) { // store event as an element BaseEvent baseEvent = ensureBaseEvent(event); SimpleEvent simpleEvent = new SimpleEvent((Event) baseEvent, serverConfigurationService().getServerIdInstance()); // add item to cache store eventCache.put(String.valueOf(eventId), simpleEvent); // update the last event id each time eventLastCache.put("lastEventId", eventId); } else { log.debug("Cannot store event to cache, event store not initialized."); } } else { log.debug("Cluster caching not enabled."); } }
final String serverIdInstance = m_serverConfigurationService.getServerIdInstance(); try
ClusterNode dbStatus = servers.put(m_serverConfigurationService.getServerIdInstance(), new ClusterNodeImpl(m_serverConfigurationService.getServerId(), status, new Date())); if (dbStatus == null) log.warn("Failed to find ourselves in the cluster: "+ m_serverConfigurationService.getServerIdInstance());
+ "("+serverConfigurationService.getServerId()+") ["+serverConfigurationService.getServerIdInstance()+"]\n ";
/** * Service INIT */ public void init() { String clientServers = serverConfigurationService.getString("memory.hc.server", null); boolean clientConfigured = StringUtils.isNotBlank(clientServers); if (clientConfigured) { ClientConfig clientConfig = new ClientConfig(); ClientNetworkConfig clientNetworkConfig = new ClientNetworkConfig(); clientNetworkConfig.addAddress(StringUtils.split(clientServers, ',')); clientConfig.setNetworkConfig(clientNetworkConfig); hcInstance = HazelcastClient.newHazelcastClient(clientConfig); } else { // start up a local server instead Config localConfig = new Config(); localConfig.setInstanceName(serverConfigurationService.getServerIdInstance()); hcInstance = Hazelcast.newHazelcastInstance(localConfig); } if (hcInstance == null) { throw new IllegalStateException("init(): HazelcastInstance is null!"); } log.info("INIT: " + hcInstance.getName() + " ("+(clientConfigured?"client:"+hcInstance.getClientService():"localServer")+"), cache maps: " + hcInstance.getDistributedObjects()); }
session = new BaseUsageSession(this, idManager().createUuid(), serverConfigurationService().getServerIdInstance(), userId, remoteAddress, hostName, userAgent);
if (us != null) { String serverInstanceId = serverConfigurationService.getServerIdInstance(); if ((serverInstanceId != null) && (!serverInstanceId.equals(us.getServer()))) {
if (us != null) { String serverInstanceId = serverConfigurationService.getServerIdInstance(); if ((serverInstanceId != null) && (!serverInstanceId.equals(us.getServer()))) {
serverInstance = serverConfigurationService().getServerIdInstance(); serverId = serverConfigurationService().getServerId(); serverConfigurationService().getServerId(), serverConfigurationService().getServerInstance(), serverConfigurationService().getServerIdInstance(), sakaiVersion);