Exemple #1
0
 protected void markInError() {
   int oldState, newState;
   for (; ; ) {
     oldState = this.state;
     newState = oldState | ERROR;
     if (stateUpdater.compareAndSet(this, oldState, newState)) {
       UndertowLogger.ROOT_LOGGER.nodeIsInError(jvmRoute);
       return;
     }
   }
 }
 @Override
 public HttpHandler createHandler(
     HttpHandler next, final OperationContext context, ModelNode model)
     throws OperationFailedException {
   String path = PATH.resolveModelAttribute(context, model).asString();
   UndertowLogger.ROOT_LOGGER.infof("Creating file handler for path %s", path);
   FileResourceManager resourceManager = new FileResourceManager(Paths.get(path));
   ResourceHandler handler = new ResourceHandler();
   handler.setResourceManager(resourceManager);
   handler.setDirectoryListingEnabled(true);
   return handler;
 }
Exemple #3
0
 /**
  * Mark a node in error. Mod_cluster has a threshold after which broken nodes get removed.
  *
  * @return
  */
 private int healthCheckFailed() {
   int oldState, newState;
   for (; ; ) {
     oldState = this.state;
     if ((oldState & ERROR) != ERROR) {
       newState = oldState | ERROR;
       UndertowLogger.ROOT_LOGGER.nodeIsInError(jvmRoute);
     } else if ((oldState & ERROR_MASK) == ERROR_MASK) {
       return ERROR_MASK;
     } else {
       newState = oldState + 1;
     }
     if (stateUpdater.compareAndSet(this, oldState, newState)) {
       return newState & ERROR_MASK;
     }
   }
 }