private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType( TimeoutBehaviorType.EXCEPTION.getTypeName() ); } }
private NonStopConfigurationFields.NonStopReadTimeoutBehavior convertEhcacheBehaviorToToolkitReadBehavior() { TimeoutBehaviorConfiguration behaviorConfiguration = ehcacheNonStopConfig.getTimeoutBehavior(); switch (behaviorConfiguration.getTimeoutBehaviorType()) { case EXCEPTION: return NonStopConfigurationFields.NonStopReadTimeoutBehavior.EXCEPTION; case LOCAL_READS: case LOCAL_READS_AND_EXCEPTION_ON_WRITES: return NonStopConfigurationFields.NonStopReadTimeoutBehavior.LOCAL_READS; case NOOP: return NonStopConfigurationFields.NonStopReadTimeoutBehavior.NO_OP; default: return NonStopConfigurationFields.DEFAULT_NON_STOP_READ_TIMEOUT_BEHAVIOR; } }
private NonStopConfigurationFields.NonStopWriteTimeoutBehavior convertEhcacheBehaviorToToolkitWriteBehavior() { TimeoutBehaviorConfiguration behaviorConfiguration = ehcacheNonStopConfig.getTimeoutBehavior(); switch (behaviorConfiguration.getTimeoutBehaviorType()) { case EXCEPTION: case LOCAL_READS_AND_EXCEPTION_ON_WRITES: return NonStopConfigurationFields.NonStopWriteTimeoutBehavior.EXCEPTION; case LOCAL_READS: return NonStopConfigurationFields.NonStopWriteTimeoutBehavior.NO_OP; case NOOP: return NonStopConfigurationFields.NonStopWriteTimeoutBehavior.NO_OP; default: return NonStopConfigurationFields.DEFAULT_NON_STOP_WRITE_TIMEOUT_BEHAVIOR; } }
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType(TimeoutBehaviorType.EXCEPTION.getTypeName()); }
private void handleNonStopException(NonStopException e, String eventType, Ehcache cache, Element element) { final String cacheName = cache == null ? null : cache.getName(); final String msg = "Terracotta clustered event notification timed out: operation: " + eventType + ", cache: " + cacheName + ", element: " + element; switch (ehcacheNonStopConfiguration.getTimeoutBehavior().getTimeoutBehaviorType()) { case EXCEPTION: throw new NonStopCacheException(msg); default: LOGGER.info(msg); } }
private void handleNonStopToolkitInstantiationException(NonStopToolkitInstantiationException e) { // THIS IS HAND MADE CODE -- DO NOT GENERATED switch (ehcacheNonStopConfiguration.getTimeoutBehavior().getTimeoutBehaviorType()) { case EXCEPTION: nonstopObserver.end(NonStopOperationOutcomes.FAILURE); throw new NonStopCacheException("Error while initializing cache", e); default: LOGGER.error("Error while initializing cache", e); } }
private void init() { if (nonstopConfiguration == null) { return; } if (nonstopConfiguration.getTimeoutBehavior() != null && !isDefault(nonstopConfiguration.getTimeoutBehavior())) { addChildElement(new TimeoutBehaviorConfigurationElement(this, nonstopConfiguration.getTimeoutBehavior())); } addAttribute(new SimpleNodeAttribute("enabled", nonstopConfiguration.isEnabled()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_ENABLED)); addAttribute(new SimpleNodeAttribute("immediateTimeout", nonstopConfiguration.isImmediateTimeout()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_IMMEDIATE_TIMEOUT)); addAttribute(new SimpleNodeAttribute("timeoutMillis", nonstopConfiguration.getTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_TIMEOUT_MILLIS)); addAttribute(new SimpleNodeAttribute("searchTimeoutMillis", nonstopConfiguration.getSearchTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_SEARCH_TIMEOUT_MILLIS)); }
TimeoutBehaviorConfiguration behaviorConfiguration = ehcacheNonStopConfiguration.getTimeoutBehavior(); switch (behaviorConfiguration.getTimeoutBehaviorType()) { case EXCEPTION:
/** * {@inheritDoc} */ public NonstopStore resolveTimeoutBehaviorStore() { final TimeoutBehaviorType timeoutBehaviorType = nonstopConfig.getTimeoutBehavior().getTimeoutBehaviorType(); NonstopStore timeoutStore = timeoutBehaviors.get(timeoutBehaviorType); if (timeoutStore == null) { timeoutStore = nonstopConfig.getTimeoutBehavior().getNonstopTimeoutBehaviorFactory() .createNonstopTimeoutBehaviorStore(nonstopActiveDelegateHolder); NonstopStore prev = timeoutBehaviors.putIfAbsent(timeoutBehaviorType, timeoutStore); if (prev != null) { timeoutStore = prev; } } return timeoutStore; }
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType( TimeoutBehaviorType.EXCEPTION.getTypeName() ); } }
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType(TimeoutBehaviorType.EXCEPTION.getTypeName()); }
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType(TimeoutBehaviorType.EXCEPTION.getTypeName()); }
private static void setupHibernateTimeoutBehavior(NonstopConfiguration nonstopConfig) { nonstopConfig.getTimeoutBehavior().setType(TimeoutBehaviorType.EXCEPTION.getTypeName()); }
/** * {@inheritDoc} */ public <V> V executeClusterOperation(final ClusterOperation<V> operation) { try { return executeWithExecutor(new ClusterOperationCallableImpl<V>(operation)); } catch (TimeoutException e) { return operation.performClusterOperationTimedOut(this.nonstopConfiguration.getTimeoutBehavior().getTimeoutBehaviorType()); } }
/** * {@inheritDoc} */ public V call() throws Exception { if (isExplicitLockApi()) { // always invoke directly the explicit locking apis return cacheOperationCallable.call(); } if (appThreadLockContext.areLocksAcquiredByOtherThreads(NonstopThreadUniqueIdProvider.getCurrentNonstopThreadUniqueId())) { // invalid lock state, some other thread has acquired explicit locks for the app thread corresponding // to this nonstop thread, which can only be another nonstop thread before rejoin. // Meaning rejoin happened and as locks are invalid after rejoin, throw exception if configured switch (nonstopConfiguration.getTimeoutBehavior().getTimeoutBehaviorType()) { case NOOP: case LOCAL_READS: // for noop and localReads, make the executor service rethrow as TimeoutException, // so that appropriate action according to behavior can be done throw new ThrowTimeoutException(); default: // always throw InvalidLockStateAfterRejoinException for exception-on-timeout behavior throw new InvalidLockStateAfterRejoinException(); } } else { return cacheOperationCallable.call(); } }
private void init() { if (nonstopConfiguration == null) { return; } if (nonstopConfiguration.getTimeoutBehavior() != null && !isDefault(nonstopConfiguration.getTimeoutBehavior())) { addChildElement(new TimeoutBehaviorConfigurationElement(this, nonstopConfiguration.getTimeoutBehavior())); } addAttribute(new SimpleNodeAttribute("enabled", nonstopConfiguration.isEnabled()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_ENABLED)); addAttribute(new SimpleNodeAttribute("immediateTimeout", nonstopConfiguration.isImmediateTimeout()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_IMMEDIATE_TIMEOUT)); addAttribute(new SimpleNodeAttribute("timeoutMillis", nonstopConfiguration.getTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_TIMEOUT_MILLIS)); }
private void init() { if (nonstopConfiguration == null) { return; } if (nonstopConfiguration.getTimeoutBehavior() != null && !isDefault(nonstopConfiguration.getTimeoutBehavior())) { addChildElement(new TimeoutBehaviorConfigurationElement(this, nonstopConfiguration.getTimeoutBehavior())); } addAttribute(new SimpleNodeAttribute("enabled", nonstopConfiguration.isEnabled()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_ENABLED)); addAttribute(new SimpleNodeAttribute("immediateTimeout", nonstopConfiguration.isImmediateTimeout()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_IMMEDIATE_TIMEOUT)); addAttribute(new SimpleNodeAttribute("timeoutMillis", nonstopConfiguration.getTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_TIMEOUT_MILLIS)); addAttribute(new SimpleNodeAttribute("searchTimeoutMillis", nonstopConfiguration.getSearchTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_SEARCH_TIMEOUT_MILLIS)); }
private void init() { if (nonstopConfiguration == null) { return; } if (nonstopConfiguration.getTimeoutBehavior() != null && !isDefault(nonstopConfiguration.getTimeoutBehavior())) { addChildElement(new TimeoutBehaviorConfigurationElement(this, nonstopConfiguration.getTimeoutBehavior())); } addAttribute(new SimpleNodeAttribute("enabled", nonstopConfiguration.isEnabled()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_ENABLED)); addAttribute(new SimpleNodeAttribute("immediateTimeout", nonstopConfiguration.isImmediateTimeout()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_IMMEDIATE_TIMEOUT)); addAttribute(new SimpleNodeAttribute("timeoutMillis", nonstopConfiguration.getTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_TIMEOUT_MILLIS)); addAttribute(new SimpleNodeAttribute("searchTimeoutMillis", nonstopConfiguration.getSearchTimeoutMillis()).optional(true).defaultValue( NonstopConfiguration.DEFAULT_SEARCH_TIMEOUT_MILLIS)); }