/** * Create a <code>BootstrapCacheLoader</code> * * @param properties implementation specific properties. These are configured as comma * separated name value pairs in ehcache.xml * @return a constructed BootstrapCacheLoader */ public RMIBootstrapCacheLoader createBootstrapCacheLoader(Properties properties) { boolean bootstrapAsynchronously = extractBootstrapAsynchronously(properties); int maximumChunkSizeBytes = extractMaximumChunkSizeBytes(properties); return new RMIBootstrapCacheLoader(bootstrapAsynchronously, maximumChunkSizeBytes); }
/** * Start the heartbeat thread */ public final void init() { serverThread = new MulticastServerThread(); serverThread.start(); }
/** * Bootstraps the cache from a random CachePeer. Requests are done in chunks estimated at 5MB Serializable * size. This balances memory use on each end and network performance. * * @throws RemoteCacheException * if anything goes wrong with the remote call */ public void load(Ehcache cache) throws RemoteCacheException { if (asynchronous) { BootstrapThread bootstrapThread = new BootstrapThread(cache); bootstrapThread.start(); } else { doLoad(cache); } }
private void processPayload(byte[] compressedPayload) { byte[] payload = PayloadUtil.ungzip(compressedPayload); String rmiUrls = new String(payload); if (self(rmiUrls)) { return; } rmiUrls = rmiUrls.trim(); LOG.debug("rmiUrls received {}", rmiUrls); processRmiUrls(rmiUrls); }
/** * Creates a clone of this listener. This method will only be called by ehcache before a cache is initialized. * <p> * This may not be possible for listeners after they have been initialized. Implementations should throw * CloneNotSupportedException if they do not support clone. * * @return a clone * @throws CloneNotSupportedException if the listener could not be cloned. */ public Object clone() throws CloneNotSupportedException { //shutup checkstyle super.clone(); return new RMIAsynchronousCacheReplicator(replicatePuts, replicatePutsViaCopy, replicateUpdates, replicateUpdatesViaCopy, replicateRemovals, replicationInterval, maximumBatchSize); }
/** * RemoteDebugger thread method. */ public final void run() { try { doLoad(cache); } catch (RemoteCacheException e) { LOG.warn("Error asynchronously performing bootstrap. The cause was: " + e.getMessage(), e); } finally { cache = null; } }
public ReplicationThread() { super("Replication Thread"); setDaemon(true); setPriority(Thread.NORM_PRIORITY); }
/** * Creates and starts a multicast peer provider * * @param groupMulticastAddress 224.0.0.1 to 239.255.255.255 e.g. 230.0.0.1 * @param groupMulticastPort 1025 to 65536 e.g. 4446 * @param hostAddress the address of the interface to use for sending and receiving multicast. May be null. */ public MulticastRMICacheManagerPeerProvider(CacheManager cacheManager, InetAddress groupMulticastAddress, Integer groupMulticastPort, Integer timeToLive, InetAddress hostAddress) { super(cacheManager); heartBeatReceiver = new MulticastKeepaliveHeartbeatReceiver(this, groupMulticastAddress, groupMulticastPort, hostAddress); heartBeatSender = new MulticastKeepaliveHeartbeatSender(cacheManager, groupMulticastAddress, groupMulticastPort, timeToLive, hostAddress); }
/** * Clones this loader */ @Override public Object clone() throws CloneNotSupportedException { //checkstyle return new RMIBootstrapCacheLoader(asynchronous, maximumChunkSizeBytes); }
/** * Asserts that the replicator is active. * * @return true if the status is not STATUS_ALIVE */ public final boolean notAlive() { return !alive(); }
/** * @return true if because of SoftReference GC this LegacyEventMessage is no longer valid */ public boolean isValid() { if (!wasElementNotNull) { return true; } else { return getElement() != null; } }
/** * If a conflict is detected in unique resource use, this method signals the listener to attempt * automatic resolution of the resource conflict. * * @throws IllegalStateException if the statis of the listener is not {@link net.sf.ehcache.Status#STATUS_UNINITIALISED} */ public void attemptResolutionOfUniqueResourceConflict() throws IllegalStateException, CacheException { assignFreePort(true); }
/** * Constructor */ public MulticastReceiverThread() { super("Multicast Heartbeat Receiver Thread"); setDaemon(true); }
/** * Constructor */ public MulticastServerThread() { super("Multicast Heartbeat Sender Thread"); setDaemon(true); }
/** * Give the replicator a chance to flush the replication queue, then cleanup and free resources when no longer needed */ public final void dispose() { status = Status.STATUS_SHUTDOWN; flushReplicationQueue(); }
/** * Time for a cluster to form. This varies considerably, depending on the implementation. * * @return the time in ms, for a cluster to form */ public long getTimeForClusterToForm() { return MulticastKeepaliveHeartbeatSender.getHeartBeatInterval() * 2 + SHORT_DELAY; }
/** * The time after which an unrefreshed peer provider entry is considered stale. */ protected long getStaleTime() { return MulticastKeepaliveHeartbeatSender.getHeartBeatStaleTime(); }
/** * A template method to dispose an individual RMICachePeer. This consists of: * <ol> * <li>Unbinding the peer from the naming service * <li>Unexporting the peer * </ol> * Override to specialise behaviour * * @param rmiCachePeer the cache peer to dispose of * @throws Exception thrown if something goes wrong */ protected void disposeRMICachePeer(RMICachePeer rmiCachePeer) throws Exception { unbind(rmiCachePeer); }
private void registerNotification(String rmiUrl) { peerProvider.registerPeer(rmiUrl); }