Package org.jscsi.scsi.tasks

Examples of org.jscsi.scsi.tasks.Task


      if (lun < 0)
      {
         try
         {
            Task task = this.taskFactory.getInstance(port, command);
            assert task != null : "improper task factory implementation returned null task";
            this.targetTaskSet.offer(task); // non-blocking, sends any errors to transport port
            if (_logger.isDebugEnabled())
               _logger.debug("successfully enqueued target command with TaskRouter: " + command);
         }
View Full Code Here


   {
      TestTargetTransportPort port = new TestTargetTransportPort(null, true);
      TaskSet set = new DefaultTaskSet(LIMITING_SET_QUEUE_DEPTH);
      List<TestTask> taskSet = new ArrayList<TestTask>();
      Nexus nexus = new Nexus("initiator", "target", 0);
      Task one = new SimpleTask(port, new Nexus(nexus, tag1), taskSet, 0);
      Task two = new SimpleTask(port, new Nexus(nexus, tag2), taskSet, 0);

      boolean result = set.offer(one);

      assertTrue("Added first task failed", result);
View Full Code Here

         _logger.debug("enqueuing command: " + command + ", associated with TargetTransportPort: "
               + port);
      }
      try
      {
         Task task = this.getTaskFactory().getInstance(port, command);
         assert task != null : "improper task factory implementation returned null task";
         if (_logger.isDebugEnabled())
         {
            _logger.debug("successfully constructed task: " + task);
         }
View Full Code Here

   private void finished(Long taskTag)
   {
      lock.lock(); // task execution thread is finished now, so we don't check interrupts
      try
      {
         Task task = this.tasks.remove(taskTag); // 'null' task tag is the untagged task
         this.enabled.remove(task);
         this.capacity++;
         this.notFull.signalAll();
         this.unblocked.signalAll();
      }
View Full Code Here

      }
   }

   public Task take() throws InterruptedException
   {
      Task task = null;
      while (task == null)
      {
         if (_logger.isTraceEnabled())
            _logger.trace("Polling for next task; timeout in 30 seconds");
         task = this.poll(30, TimeUnit.SECONDS);
         if (_logger.isTraceEnabled())
            _logger.trace("returning command for execution: "
                  + (task == null ? "null" : task.getCommand()));
      }
      return task;
   }
View Full Code Here

      int count = 0;
      while (true)
      {
         try
         {
            Task t = this.poll(0, TimeUnit.SECONDS);
            if (t == null)
               break;
            else
               c.add(t);
         }
View Full Code Here

      int count = 0;
      while (maxElements > 0)
      {
         try
         {
            Task t = this.poll(0, TimeUnit.SECONDS);
            if (t == null)
               break;
            else
               c.add(t);
         }
View Full Code Here

      throw new UnsupportedOperationException();
   }

   public Task element()
   {
      Task t = this.peek();
      if (t == null)
         throw new NoSuchElementException();
      return t;
   }
View Full Code Here

      }
   }

   public Task remove()
   {
      Task t = this.poll();
      if (t == null)
         throw new NoSuchElementException();
      return t;
   }
View Full Code Here

      this.currentThread = Thread.currentThread();
      this.running.set(true);

      while (this.running.get())
      {
         Task nextTask = null;
         try
         {
            if (_logger.isDebugEnabled())
               _logger.debug("Waiting for next task...");
            nextTask = this.taskSet.take();
            if (_logger.isDebugEnabled())
               _logger.debug("next from taskset is task: " + nextTask.getCommand());
            this.executor.submit(nextTask);
            if (_logger.isDebugEnabled())
               _logger.debug("submitted for execution command: " + nextTask.getCommand());
         }
         catch (InterruptedException e)
         {
            _logger.debug("Task manager thread interrupted.");
            this.running.set(false);
View Full Code Here

TOP

Related Classes of org.jscsi.scsi.tasks.Task

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.