com.hazelcast.spi.impl.operationexecutor.classic
Interface ScheduleQueue

All Known Implementing Classes:
DefaultScheduleQueue

public interface ScheduleQueue

The ScheduleQueue is a kind of priority queue where 'tasks' are queued for scheduling.

ScheduleQueue support concurrent producers but only need to support single consumers.

The ScheduledQueue also support priority tasks; so if a task with a priority comes in, than that one is taken before any other normal operation is taken.

The ordering between normal tasks will always be FIFO. And the same goes for the ordering between priority tasks, but there is no ordering guarantee between priority and normal tasks.


Method Summary
 void add(Object task)
          Adds an task with normal priority to this queue.
 void addUrgent(Object task)
          Adds an task with normal priority to this queue.
 int normalSize()
          returns the number of normal operations pending.
 int prioritySize()
          returns the number of priority operations pending.
 int size()
          Returns the total number of pending operations.
 Object take()
          Takes an item from this queue.
 

Method Detail

add

void add(Object task)
Adds an task with normal priority to this queue.

This method is thread safe.

Parameters:
task - the item to add
Throws:
NullPointerException - if task is null

addUrgent

void addUrgent(Object task)
Adds an task with normal priority to this queue.

This method is thread safe.

Parameters:
task - the item to add
Throws:
NullPointerException - if task is null

take

Object take()
            throws InterruptedException
Takes an item from this queue. If no item is available, the call blocks.

This method should always be called by the same thread.

Returns:
the taken item.
Throws:
InterruptedException - if the thread is interrupted while waiting.

normalSize

int normalSize()
returns the number of normal operations pending.

This method is thread safe. This method returns a best effort value and should only be used for monitoring purposes.

Returns:
the number of normal pending operations.

prioritySize

int prioritySize()
returns the number of priority operations pending.

This method is thread safe. This method returns a best effort value and should only be used for monitoring purposes.

Returns:
the number of priority pending operations.

size

int size()
Returns the total number of pending operations.

This method is thread safe. This method returns a best effort value and should only be used for monitoring purposes.

Returns:
the total number of pending operations.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.