@Override boolean isRejected(ModelNode value) { return value.asLong() < 0; }
@Override boolean isRejected(ModelNode value) { return value.asLong() == 0L; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.interval = INTERVAL.resolveModelAttribute(context, model).asLong(); this.lifespan = LIFESPAN.resolveModelAttribute(context, model).asLong(); this.maxIdle = MAX_IDLE.resolveModelAttribute(context, model).asLong(); return this; }
@Override protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) { if (attributeValue.isDefined() && attributeValue.asLong() == 0L) { attributeValue.set(Long.MAX_VALUE); } } }, ListenerResourceDefinition.MAX_ENTITY_SIZE);
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.remoteTimeout = REMOTE_TIMEOUT.resolveModelAttribute(context, model).asLong(); return super.configure(context, model); }
public static Long getLongIfSetOrGetDefault(final OperationContext context, final ModelNode dataSourceNode, final SimpleAttributeDefinition key) throws OperationFailedException { ModelNode resolvedNode = key.resolveModelAttribute(context, dataSourceNode); return resolvedNode.isDefined() ? resolvedNode.asLong() : null; }
@Override protected void execute(final OperationContext context, final ModelNode operation, final WildFlyJobOperator jobOperator) throws OperationFailedException { // Resolve the execution id final long executionId = resolveValue(context, operation, EXECUTION_ID).asLong(); try { jobOperator.stop(executionId); } catch (NoSuchJobExecutionException | JobExecutionNotRunningException | JobSecurityException e) { throw createOperationFailure(e); } } });
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.chunkSize = CHUNK_SIZE.resolveModelAttribute(context, model).asInt(); this.timeout = TIMEOUT.resolveModelAttribute(context, model).asLong(); return this; } }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.exhaustedAction = ExhaustedAction.valueOf(ConnectionPoolResourceDefinition.Attribute.EXHAUSTED_ACTION.resolveModelAttribute(context, model).asString()); this.maxActive = ConnectionPoolResourceDefinition.Attribute.MAX_ACTIVE.resolveModelAttribute(context, model).asInt(); this.maxWait = ConnectionPoolResourceDefinition.Attribute.MAX_WAIT.resolveModelAttribute(context, model).asLong(); this.minEvictableIdleTime = ConnectionPoolResourceDefinition.Attribute.MIN_EVICTABLE_IDLE_TIME.resolveModelAttribute(context, model).asLong(); this.minIdle = ConnectionPoolResourceDefinition.Attribute.MIN_IDLE.resolveModelAttribute(context, model).asInt(); return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.remoteCacheName = CACHE.resolveModelAttribute(context, model).asString(); this.socketTimeout = SOCKET_TIMEOUT.resolveModelAttribute(context, model).asLong(); this.tcpNoDelay = TCP_NO_DELAY.resolveModelAttribute(context, model).asBoolean(); List<String> bindings = StringListAttributeDefinition.unwrapValue(context, SOCKET_BINDINGS.resolveModelAttribute(context, model)); this.bindings = new ArrayList<>(bindings.size()); for (String binding : bindings) { this.bindings.add(new ServiceSupplierDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding))); } return super.configure(context, model); }
@Override protected void execute(final OperationContext context, final ModelNode operation, final WildFlyJobOperator jobOperator) throws OperationFailedException { // Resolve the execution id final long executionId = resolveValue(context, operation, EXECUTION_ID).asLong(); final Properties properties = resolvePropertyValue(context, operation, PROPERTIES); try { final long newExecutionId = jobOperator.restart(executionId, properties); context.getResult().set(newExecutionId); } catch (JobExecutionAlreadyCompleteException | NoSuchJobExecutionException | JobExecutionNotMostRecentException | JobRestartException | JobSecurityException e) { throw createOperationFailure(e); } } });
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.invalidationBatchSize = INVALIDATION_BATCH_SIZE.resolveModelAttribute(context, model).asInt(); this.biasLifespan = BIAS_LIFESPAN.resolveModelAttribute(context, model).asLong(); return super.configure(context, model); }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.size = MemoryResourceDefinition.Attribute.SIZE.resolveModelAttribute(context, model).asLong(); this.evictionType = ModelNodes.asEnum(BinaryMemoryResourceDefinition.Attribute.EVICTION_TYPE.resolveModelAttribute(context, model), EvictionType.class); this.capacity = OffHeapMemoryResourceDefinition.Attribute.CAPACITY.resolveModelAttribute(context, model).asInt(); return this; }
private void applyModelToRuntime(OperationContext context, final ModelNode model) throws OperationFailedException { long timeout = attribute.resolveModelAttribute(context, model).asLong(); final ServiceRegistry serviceRegistry = context.getServiceRegistry(true); ServiceController<DefaultAccessTimeoutService> controller = (ServiceController<DefaultAccessTimeoutService>) serviceRegistry.getService(serviceName); if (controller != null) { DefaultAccessTimeoutService service = controller.getValue(); if (service != null) { service.setDefaultAccessTimeout(timeout); } } }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.capacityFactor = CAPACITY_FACTOR.resolveModelAttribute(context, model).asInt(); this.l1Lifespan = L1_LIFESPAN.resolveModelAttribute(context, model).asLong(); this.owners = OWNERS.resolveModelAttribute(context, model).asInt(); return super.configure(context, model); }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.mode = ModelNodes.asEnum(MODE.resolveModelAttribute(context, model), TransactionMode.class); this.locking = ModelNodes.asEnum(LOCKING.resolveModelAttribute(context, model), LockingMode.class); this.timeout = STOP_TIMEOUT.resolveModelAttribute(context, model).asLong(); this.transactionDependency = !EnumSet.of(TransactionMode.NONE, TransactionMode.BATCH).contains(this.mode) ? new ServiceDependency(context.getCapabilityServiceName(LOCAL_TRANSACTION_PROVIDER.getName(), null)) : null; this.tsrDependency = this.mode == TransactionMode.NON_XA ? new ServiceSupplierDependency<>(context.getCapabilityServiceName(TRANSACTION_SYNCHRONIZATION_REGISTRY.getName(), null)) : null; return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.timeout = ACQUIRE_TIMEOUT.resolveModelAttribute(context, model).asLong(); this.concurrency = CONCURRENCY.resolveModelAttribute(context, model).asInt(); this.isolation = ModelNodes.asEnum(ISOLATION.resolveModelAttribute(context, model), IsolationLevel.class); this.striping = STRIPING.resolveModelAttribute(context, model).asBoolean(); return this; } }
@Override public JGroupsTransportServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.lockTimeout = LOCK_TIMEOUT.resolveModelAttribute(context, model).asLong(); this.channel = CHANNEL.resolveModelAttribute(context, model).asStringOrNull(); this.factory = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, this.channel)); this.cluster = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_CLUSTER.getServiceName(context, this.channel)); return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.setMinThreads(this.definition.getMinThreads().resolveModelAttribute(context, model).asInt()); this.setMaxThreads(this.definition.getMaxThreads().resolveModelAttribute(context, model).asInt()); this.setKeepAliveTime(this.definition.getKeepAliveTime().resolveModelAttribute(context, model).asLong()); return this; }