gms = (GroupManagementService) gmsRunnable; try { gms.join(); gms.addActionFactory(new MessageActionFactory() { gms.shutdown(GMSConstants.shutdownType.INSTANCE_SHUTDOWN); try { byte[] message = new byte[] {}; gms.getGroupHandle().sendMessage(groupName, message); } catch (GMSException e) { Logger.getAnonymousLogger().severe(e.getMessage());
this.groupHandle = gms.getGroupHandle(); this.myName = myName; this.groupName = groupName; gms.addActionFactory(new JoinNotificationActionFactoryImpl(this)); gms.addActionFactory(new JoinedAndReadyNotificationActionFactoryImpl(this)); gms.addActionFactory(new FailureNotificationActionFactoryImpl(this)); gms.addActionFactory(new PlannedShutdownActionFactoryImpl(this)); gms.join(); Thread.sleep(3000); gms.reportJoinedAndReadyState(); } catch (Exception ex) { logger.log(Level.WARNING, "Got an exception during reportJoinedAndReadyState?", ex);
new Object[]{gms.getInstanceName(), gms.getGroupName(), event.name()}); removeFailureNotificationListener(GMSAdapterImpl.this); removeFailureSuspectedListener(GMSAdapterImpl.this); gms.shutdown(GMSConstants.shutdownType.INSTANCE_SHUTDOWN); removePlannedShutdownListener(GMSAdapterImpl.this); events.unregister(glassfishEventListener); gms.reportJoinedAndReadyState();
/** * This is called by the container after it has called refresh * * @param ejbID * the ejbID that uniquely identifies the container * @param pk * The primary key of the bean(s) that is to be refreshed */ public void notifyRefresh(long ejbID, byte[] pk) { int size = pk.length; byte[] payload = new byte[size + 8]; Logger _logger = ejbContainerUtil.getLogger(); longToBytes(ejbID, payload, 0); System.arraycopy(pk, 0, payload, 8, size); try { gms.getGroupHandle().sendMessage(GMS_READ_ONLY_COMPONENT_NAME, payload); _logger.log(Level.WARNING, "ReadOnlyBeanMessageCallBack: " + " Sent message for ejbID: " + ejbID); } catch (Exception ex) { _logger.log(Level.WARNING, "ReadOnlyBeanMessageCallBack: " + "Got exception during notifyRefresh", ex); } }
@Override public void registerGroupMessageReceiver(String messageToken, MessageReceiver receiver) { logger.fine("[GroupServiceProvider]: REGISTERED A MESSAGE LISTENER: " + receiver + "; for token: " + messageToken); gms.addActionFactory(new MessageActionFactoryImpl(receiver), messageToken); }
GroupManagementService gms = localGmsAdapter.getModule(); if (gms != null) { gms.reportJoinedAndReadyState(); if (localGmsAdapter != null) { gmsAdapters.remove(localGmsAdapter); localGmsAdapter.getModule().shutdown(GMSConstants.shutdownType.INSTANCE_SHUTDOWN); ServiceLocatorUtilities.removeFilter(habitat, BuilderHelper.createNameAndContractFilter( GMSAdapter.class.getName(), cluster.getName()));
List<String> startedGMSMembers = gms.getGroupHandle().getCurrentCoreMembers(); if (startedGMSMembers.size() == 0) { try { gms.announceGroupStartup(clusterName, GMSConstants.groupStartupState.INITIATED, clusterMembers); gmsStartCluster = true; } catch (Throwable t) {
List<String> startedGMSMembers = gms.getGroupHandle().getCurrentCoreMembers(); if (startedGMSMembers.size() > 0) { try { gms.announceGroupShutdown(clusterName, GMSConstants.shutdownState.INITIATED); gmsStopCluster = true; } catch (Throwable t) {
if (gmsAdapter != null) { conf.setClusterName(gmsAdapter.getClusterName()); conf.setInstanceName(gmsAdapter.getModule().getInstanceName());
} catch (GMSException e) { gms = getGroupManagementServiceInstance(); gms.initialize(serverToken, groupName, memberType, properties) ; memberToken = serverToken; groups.put(getCompositeKey(groupName), gms );
/** * Find records of not finished delegated recovery in the recovery lock file on * this path and recorded before specified timestamp, and do delegated recovery if such record exists */ String finishDelegatedRecovery(String logdir, long timestamp) { String delegatedLogDir = null; String instance = fence.getInstanceRecoveredFor(logdir, timestamp); if (_logger.isLoggable(Level.INFO)) { _logger.log(Level.INFO, "[GMSCallBack] Instance " + instance + " need to finish delegated recovering"); } if (instance != null) { DistributedStateCache dsc=gms.getGroupHandle().getDistributedStateCache(); Map<Serializable, Serializable> memberDetails = dsc.getFromCacheForPattern(MEMBER_DETAILS, instance ); delegatedLogDir = (String)memberDetails.get(TXLOGLOCATION); if (_logger.isLoggable(Level.INFO)) { _logger.log(Level.INFO, "[GMSCallBack] Tx log dir for instance " + instance + " is " + delegatedLogDir); } doRecovery(delegatedLogDir, instance, timestamp); } return delegatedLogDir; }
/** * Registers a GroupLeadershipNotification Listener. * * @param callback processes GMS notification GroupLeadershipNotificationSignal. This event occurs when the GMS masters leaves the Group * and another member of the group takes over leadership. The signal indicates the new leader. */ @Override public void registerGroupLeadershipNotificationListener(CallBack callback) { if (gms != null) { gms.addActionFactory(new GroupLeadershipNotificationActionFactoryImpl(callback)); } }
GroupManagementService gms = localGmsAdapter.getModule(); if (gms != null) { gms.reportJoinedAndReadyState(); if (localGmsAdapter != null) { gmsAdapters.remove(localGmsAdapter); localGmsAdapter.getModule().shutdown(GMSConstants.shutdownType.INSTANCE_SHUTDOWN); ServiceLocatorUtilities.removeFilter(habitat, BuilderHelper.createNameAndContractFilter( GMSAdapter.class.getName(), cluster.getName()));
if (gmsAdapter != null) { conf.setClusterName(gmsAdapter.getClusterName()); conf.setInstanceName(gmsAdapter.getModule().getInstanceName());
} catch (GMSException e) { gms = getGroupManagementServiceInstance(); gms.initialize(serverToken, groupName, memberType, properties) ; memberToken = serverToken; groups.put(getCompositeKey(groupName), gms );
/** * This is called by the container after it has called refresh * * @param ejbID * the ejbID that uniquely identifies the container * @param pk * The primary key of the bean(s) that is to be refreshed */ public void notifyRefreshAll(long ejbID) { byte[] payload = new byte[8]; Logger _logger = ejbContainerUtil.getLogger(); longToBytes(ejbID, payload, 0); try { gms.getGroupHandle().sendMessage(GMS_READ_ONLY_COMPONENT_NAME, payload); } catch (Exception ex) { _logger.log(Level.WARNING, "ReadOnlyBeanMessageCallBack: " + "Got exception during notifyRefreshAll", ex); } }
/** * Registers a JoinAndReadyNotification Listener. * * @param callback processes GMS notification JoinAndReadyNotificationSignal */ @Override public void registerJoinedAndReadyNotificationListener(CallBack callback) { if (gms != null && callback != null) { JoinedAndReadyNotificationActionFactory jnaf = new JoinedAndReadyNotificationActionFactoryImpl(callback); gms.addActionFactory(jnaf); callbackJoinedAndReadyActionFactoryMapping.put(callback, jnaf); } }
fineLog( "IiopFolbGmsClient: nodes {0}", nodes ); String instanceName = gmsAdapter.getModule().getInstanceName() ; fineLog( "IiopFolbGmsClient: instanceName {0}", instanceName );
private synchronized void checkAndNotifyAboutCurrentAndPreviousMembers(String memberName, boolean isJoinEvent, boolean triggeredByGMS) { SortedSet<String> currentAliveAndReadyMembers = gms.getGroupHandle().getCurrentAliveAndReadyCoreView().getMembers(); AliveAndReadyView aView = gms.getGroupHandle().getPreviousAliveAndReadyCoreView(); SortedSet<String> previousAliveAndReadyMembers = new TreeSet<String>();