Examples of ThreadTask


Examples of com.caucho.util.ThreadTask

        msg = "Already active.";
      else {
        // It's tricky to start another Thread from a Servlet.  Here
        // the Resin ThreadPool class is used.  ThreadPool will interrupt a
        // thread and stop it if it runs for too long.
        ThreadTask threadTask = new ThreadTask() {
          public void run()
          {
            task.run();
          }
        };
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

         {
            synchronized (taskList)
            {
               while (taskList.isEmpty() == false)
               {
                  ThreadTask threadTask = taskList.remove(0);
                  ClassLoadingTask loadTask = threadTask.getLoadTask();
                  Thread requestingThread = loadTask.getRequestingThread();
                  if( trace )
                     log.trace("Reassigning task: " + threadTask+" to " + requestingThread);
                  threadTask.setThread(null);
                  // Insert the task into the front of requestingThread task list
                  List<ThreadTask> toTaskList = loadTasksByThread.get(requestingThread);
                  synchronized (toTaskList)
                  {
                     toTaskList.add(0, threadTask);
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

            log.trace("End nextTask(FINISHED), task="+task);
            return;
         }
      }

      ThreadTask threadTask = taskList.remove(0);
      ClassLoadingTask loadTask = threadTask.getLoadTask();
      if (trace)
         log.trace("Begin nextTask(" + taskList.size() + "), loadTask=" + loadTask);

      try
      {
         Thread taskThread = threadTask.getThread();
         if (taskThread == null)
         {
            /* This is a task that has been reassigned back to the original
            requesting thread ClassLoadingTask, so a new ThreadTask must
            be scheduled.
            */
            if (trace)
               log.trace("Rescheduling threadTask=" + threadTask);
            scheduleTask(loadTask, threadTask.getLoader(), true);
         }
         else
         {
            if (trace)
               log.trace("Running threadTask=" + threadTask);
            threadTask.run();
         }
      }
      catch (Throwable e)
      {
         if (trace)
            log.trace("Run failed with exception", e);
         boolean retry = e instanceof ClassCircularityError || e.getClass().equals(LinkageError.class);
         if (retry && loadTask.incrementNumCCE() < MAX_CCE)
         {
            /* Reschedule this task after all existing tasks to allow the
            current load tasks which are conflicting to complete.
            */
            try
            {
               // Reschedule and update the loadTask.threadTaskCount
               scheduleTask(loadTask, threadTask.getLoader(), true);
            }
            catch (Throwable ex)
            {
               loadTask.setLoadError(ex);
               log.warn("Failed to reschedule task after CCE", ex);
            }
            if (trace)
               log.trace("Post CCE state, loadTask=" + loadTask);
         }
         else
         {
            loadTask.setLoadError(e);
         }
      }
      finally
      {
         // Release any lock on the classloader
         if (threadTask.isReleaseInNextTask())
            threadTask.getClassLoader().unlock(false);
      }

      // If the ThreadTasks are complete mark the ClassLoadingTask finished
      if (loadTask.getThreadTaskCount() == 0)
      {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

      if (trace)
         log.trace("ScheduleTask task=" + task + " loader=" + loader + " reschedule=" + reschedule);
     
      Thread thread;
      boolean releaseInNextTask = false;
      ThreadTask subtask;
      List<ThreadTask> taskList;

      BaseClassLoader classLoader = null;
      if (loader instanceof BaseDelegateLoader)
      {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

      {
         synchronized (taskList)
         {
            while (taskList.isEmpty() == false)
            {
               ThreadTask threadTask = taskList.remove(0);
               ClassLoadingTask loadTask = threadTask.getLoadTask();
               Thread requestingThread = loadTask.getRequestingThread();
               if( trace )
                  log.trace("Reassigning task: " + threadTask+" to " + requestingThread);
               threadTask.setThread(null);
               // Insert the task into the front of requestingThread task list
               List<ThreadTask> toTaskList = loadTasksByThread.get(requestingThread);
               synchronized (toTaskList)
               {
                  toTaskList.add(0, threadTask);
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

            log.trace("End nextTask(FINISHED), task="+task);
            return;
         }
      }

      ThreadTask threadTask = taskList.remove(0);
      ClassLoadingTask loadTask = threadTask.getLoadTask();
      if (trace)
         log.trace("Begin nextTask(" + taskList.size() + "), loadTask=" + loadTask);

      try
      {
         Thread taskThread = threadTask.getThread();
         if (taskThread == null)
         {
            /* This is a task that has been reassigned back to the original
            requesting thread ClassLoadingTask, so a new ThreadTask must
            be scheduled.
            */
            if (trace)
               log.trace("Rescheduling threadTask=" + threadTask);
            scheduleTask(loadTask, threadTask.getLoader(), true);
         }
         else
         {
            if (trace)
               log.trace("Running threadTask=" + threadTask);
            threadTask.run();
         }
      }
      catch (Throwable e)
      {
         if (trace)
            log.trace("Run failed with exception", e);
         boolean retry = e instanceof ClassCircularityError || e.getClass().equals(LinkageError.class);
         if (retry && loadTask.incrementNumCCE() < MAX_CCE)
         {
            /* Reschedule this task after all existing tasks to allow the
            current load tasks which are conflicting to complete.
            */
            try
            {
               // Reschedule and update the loadTask.threadTaskCount
               scheduleTask(loadTask, threadTask.getLoader(), true);
            }
            catch (Throwable ex)
            {
               loadTask.setLoadError(ex);
               log.warn("Failed to reschedule task after CCE", ex);
            }
            if (trace)
               log.trace("Post CCE state, loadTask=" + loadTask);
         }
         else
         {
            loadTask.setLoadError(e);
         }
      }
      finally
      {
         // Release any lock on the classloader
         if (threadTask.isReleaseInNextTask())
            threadTask.getClassLoader().unlock();
      }

      // If the ThreadTasks are complete mark the ClassLoadingTask finished
      if (loadTask.getThreadTaskCount() == 0)
      {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

      if (trace)
         log.trace("ScheduleTask task=" + task + " loader=" + loader + " reschedule=" + reschedule);
     
      Thread thread;
      boolean releaseInNextTask = false;
      ThreadTask subtask;
      List<ThreadTask> taskList;

      BaseClassLoader classLoader = null;
      if (loader instanceof BaseDelegateLoader)
      {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

            synchronized (taskList)
            {
               List<ThreadTask> ourselves = null;
               while (taskList.isEmpty() == false)
               {
                  ThreadTask threadTask = taskList.remove(0);
                  ClassLoadingTask loadTask = threadTask.getLoadTask();
                  Thread requestingThread = loadTask.getRequestingThread();
                  if( trace )
                     log.trace("Reassigning task: " + threadTask+" to " + requestingThread);
                  threadTask.setThread(null);
                  // Insert the task into the front of requestingThread task list
                  List<ThreadTask> toTaskList = loadTasksByThread.get(requestingThread);
                  // Our we assigning to ourselves?
                  if (toTaskList == taskList)
                  {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

               log.trace("End nextTask(FINISHED), task="+task);
               return;
            }
         }

         ThreadTask threadTask = taskList.remove(0);
         ClassLoadingTask loadTask = threadTask.getLoadTask();
         if (trace)
            log.trace("Begin nextTask(" + taskList.size() + "), loadTask=" + loadTask);

         try
         {
            Thread taskThread = threadTask.getThread();
            if (taskThread == null)
            {
               /* This is a task that has been reassigned back to the original
               requesting thread ClassLoadingTask, so a new ThreadTask must
               be scheduled.
               */
               if (trace)
                  log.trace("Rescheduling threadTask=" + threadTask);
               scheduleTask(loadTask, threadTask.getLoader(), true);
            }
            else
            {
               if (trace)
                  log.trace("Running threadTask=" + threadTask);
               threadTask.run();
            }
         }
         catch (Throwable e)
         {
            if (trace)
               log.trace("Run failed with exception", e);
            boolean retry = e instanceof ClassCircularityError || e.getClass().equals(LinkageError.class);
            if (retry && loadTask.incrementNumCCE() < MAX_CCE)
            {
               /* Reschedule this task after all existing tasks to allow the
               current load tasks which are conflicting to complete.
               */
               try
               {
                  // Reschedule and update the loadTask.threadTaskCount
                  scheduleTask(loadTask, threadTask.getLoader(), true);
               }
               catch (Throwable ex)
               {
                  loadTask.setLoadError(ex);
                  log.warn("Failed to reschedule task after CCE", ex);
               }
               if (trace)
                  log.trace("Post CCE state, loadTask=" + loadTask);
            }
            else
            {
               loadTask.setLoadError(e);
            }
         }
         finally
         {
            // Release any lock on the classloader
            if (threadTask.isReleaseInNextTask())
               threadTask.getClassLoader().unlock(false);
         }

         // If the ThreadTasks are complete mark the ClassLoadingTask finished
         if (loadTask.getThreadTaskCount() == 0)
         {
View Full Code Here

Examples of org.jboss.classloader.spi.base.ClassLoadingTask.ThreadTask

      if (trace)
         log.trace("ScheduleTask task=" + task + " loader=" + loader + " reschedule=" + reschedule);
     
      Thread thread;
      boolean releaseInNextTask = false;
      ThreadTask subtask;
      List<ThreadTask> taskList;

      BaseClassLoader classLoader = null;
      if (loader instanceof BaseDelegateLoader)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.