Package eu.mosaic_cloud.tools.threading.core

Examples of eu.mosaic_cloud.tools.threading.core.ThreadingContext


  }
 
  @Deprecated
  public static final ThreadingContext getDefaultContext ()
  {
    final ThreadingContext context = Threading.defaultContext.get ();
    Preconditions.checkState (context != null);
    return (context);
  }
View Full Code Here


    protected final ThreadingContext initialValue ()
    {
      synchronized (this) {
        try {
          this.initialValueActive = true;
          ThreadingContext context = super.initialValue ();
          final Thread thread = Thread.currentThread ();
          if (context == null) {
            if (thread instanceof ManagedThread) {
              context = ((ManagedThread) thread).getContext ();
              Preconditions.checkNotNull (context);
            }
          }
          if (context == null) {
            for (ThreadGroup group = thread.getThreadGroup (); group != null; group = group.getParent ())
              if (group instanceof ManagedThreadGroup) {
                context = ((ManagedThreadGroup) group).getContext ();
                Preconditions.checkNotNull (context);
                break;
              }
          }
          if (context != null) {
            if (!context.isManaged (thread))
              context.registerThread (thread);
          }
          return (context);
        } finally {
          this.initialValueActive = false;
        }
View Full Code Here

    final ClassLoader classLoader;
    if (classLoader_ == null)
      classLoader = BasicComponentHarnessMain.prepareClassLoader (arguments, transcript, exceptions);
    else
      classLoader = classLoader_;
    final ThreadingContext threading;
    if (threading_ == null) {
      transcript.traceDebugging ("creating threading context...");
      final BasicThreadingContext threading1 = BasicThreadingContext.create (BasicComponentHarnessMain.class, exceptions, UncaughtExceptionHandler.create (exceptions), classLoader);
      transcript.traceDebugging ("initializing threading context...");
      threading1.initialize ();
View Full Code Here

 
  @Override
  public final void checkAccess (final Thread thread)
  {
    Preconditions.checkNotNull (thread);
    final ThreadingContext context = Threading.getCurrentContext ();
    // FIXME: ??? (I don't remember what the problem was...)
    if (context != null) {
      // FIXME: do an enforcement, not just logging...
      if (!context.isManaged (thread)) {
        this.logger.warn ("thread access check failed for thread: {}; ignoring!", thread);
        //# throw (new SecurityException ());
      }
    }
    super.checkAccess (thread);
View Full Code Here

 
  @Override
  public final void checkAccess (final ThreadGroup group)
  {
    Preconditions.checkNotNull (group);
    final ThreadingContext context = Threading.getCurrentContext ();
    // FIXME: ??? (I don't remember what the problem was...)
    if (context != null) {
      // FIXME: do an enforcement, not just logging...
      if (!context.isManaged (group)) {
        this.logger.warn ("thread access check failed for thread group: {}; ignoring!", group);
        //# throw (new SecurityException ());
      }
    }
    super.checkAccess (group);
View Full Code Here

  }
 
  @Override
  public final ThreadGroup getThreadGroup ()
  {
    final ThreadingContext context = Threading.getCurrentContext ();
    if (context != null) {
      final ThreadGroup group = context.getDefaultThreadGroup ();
      if (group == null)
        throw (new IllegalThreadStateException ());
      return (group);
    }
    return (super.getThreadGroup ());
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.tools.threading.core.ThreadingContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.