@Override public Future<?> submit( Runnable runnable ) { return new FuturePast(new RunAndReturn(runnable, null)); }
@Override public <T> List<Future<T>> invokeAll( Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit ) throws InterruptedException { return invokeAll( collection ); }
@Override public <T> T invokeAny( Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit ) throws InterruptedException, ExecutionException, TimeoutException { return invokeAny( collection ); }
public static String getLockReservationName() { ThreadContext ctx = ThreadContext.getContext( true ); String ownerName = (String) ctx.get( PARTYLINE_LOCK_OWNER ); if ( ownerName == null ) { ownerName = "Context of: " + Thread.currentThread().getName(); ctx.put( PARTYLINE_LOCK_OWNER, ownerName ); } return ownerName; }
@Produces @WeftManaged public ExecutorService getExecutorService( final InjectionPoint ip ) { return getExec( ip, false ); }
@Override public ScheduledFuture<?> schedule( Runnable runnable, long l, TimeUnit timeUnit ) { return asScheduled( ( d ) -> d.schedule( wrapRunnable( runnable ), l, timeUnit ) ); }
@Produces @WeftScheduledExecutor public ScheduledExecutorService getScheduledExecutorService( final InjectionPoint ip ) { return (ScheduledExecutorService) getExec( ip, true ); }
@Override public <V> ScheduledFuture<V> schedule( Callable<V> callable, long l, TimeUnit timeUnit ) { return asScheduled( (d) -> d.schedule( wrapCallable( callable ), l, timeUnit ) ); }
@Override public Future<?> submit( Runnable runnable ) { return delegate.submit( wrapRunnable( runnable ) ); }
@Override public <T> T invokeAny( Collection<? extends Callable<T>> collection ) throws InterruptedException, ExecutionException { return delegate.invokeAny( wrapAll( collection ) ); }
@Override public <T> Future<T> submit( Callable<T> callable ) { return new FuturePast(callable); }
@Override public T get( long l, TimeUnit timeUnit ) throws InterruptedException, ExecutionException, TimeoutException { return get(); } }
public Locker() { this.locks = Collections.synchronizedMap( new ContextSensitiveWeakHashMap<>() ); }
public static void clearContext() { swapContext( null ); MDC.clear(); }
@Override public <T> Future<T> submit( Runnable runnable, T t ) { return new FuturePast(new RunAndReturn(t, runnable)); }
@Override public ScheduledFuture<?> scheduleAtFixedRate( Runnable runnable, long l, long l1, TimeUnit timeUnit ) { return asScheduled( ( d ) -> d.scheduleAtFixedRate( wrapRunnable( runnable ), l, l1, timeUnit ) ); }
@Override public <T> Future<T> submit( Runnable runnable, T t ) { return delegate.submit( wrapRunnable( runnable ), t ); }
@Override public <T> T invokeAny( Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit ) throws InterruptedException, ExecutionException, TimeoutException { return delegate.invokeAny( wrapAll( collection ), l, timeUnit ); }
@Override public void execute( Runnable runnable ) { delegate.execute( wrapRunnable( runnable ) ); }
@Override public <T> List<Future<T>> invokeAll( Collection<? extends Callable<T>> collection, long l, TimeUnit timeUnit ) throws InterruptedException { return delegate.invokeAll( wrapAll( collection ), l, timeUnit ); }