messif.algorithms.impl
Class ParallelSequentialScan

java.lang.Object
  extended by messif.algorithms.Algorithm
      extended by messif.algorithms.impl.ParallelSequentialScan
All Implemented Interfaces:
java.io.Serializable

public class ParallelSequentialScan
extends Algorithm

Parallel implementation of the naive sequential scan algorithm. Several buckets are used to store data in a round-robin fashion using the InsertOperation. Then, each QueryOperation is executed on each of the buckets in parallel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class messif.algorithms.Algorithm
Algorithm.AlgorithmConstructor
 
Field Summary
 
Fields inherited from class messif.algorithms.Algorithm
log, maximalConcurrentOperations
 
Constructor Summary
ParallelSequentialScan(int parallelization)
          Creates a new instance of ParallelSequentialScan access structure with MemoryStorageBucket as the storage class.
ParallelSequentialScan(int parallelization, java.lang.Class<? extends LocalBucket> bucketClass)
          Creates a new instance of ParallelSequentialScan access structure with specific bucket class.
ParallelSequentialScan(int parallelization, java.lang.Class<? extends LocalBucket> bucketClass, java.util.Map<java.lang.String,java.lang.Object> bucketClassParams)
          Creates a new instance of ParallelSequentialScan access structure with specific bucket class.
 
Method Summary
 void delete(DeleteByLocatorOperation operation)
          Deletes objects by locators.
 void delete(DeleteOperation operation)
          Deletes an object.
 void destroy()
          Destroy this algorithm.
 void finalize()
          Finalize the algorithm.
 void insert(BulkInsertOperation operation)
          Inserts multiple new objects.
 void insert(InsertOperation operation)
          Inserts a new object.
 void search(QueryOperation<?> operation)
          Performs a query operation.
 java.lang.String toString()
          Shows the information about this algorithm.
 
Methods inherited from class messif.algorithms.Algorithm
backgroundExecute, backgroundExecuteOperation, backgroundExecuteOperation, execute, executeOperation, getAnnotatedConstructors, getConstructorArgumentDescriptions, getConstructorDescription, getConstructorDescriptionSimple, getExecutorParamClasses, getFirstSupportedOperation, getName, getObjectClass, getOperationStatistics, getQueryAnswer, getQueryAnswer, getRunningOperationsCount, getSupportedOperations, getSupportedOperations, resetOperationStatistics, restoreFromFile, restoreFromFile, statisticsAfterOperation, statisticsBeforeOperation, storeToFile, waitBackgroundExecuteOperation, waitBackgroundExecuteOperation
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParallelSequentialScan

public ParallelSequentialScan(int parallelization,
                              java.lang.Class<? extends LocalBucket> bucketClass,
                              java.util.Map<java.lang.String,java.lang.Object> bucketClassParams)
                       throws java.lang.IllegalArgumentException
Creates a new instance of ParallelSequentialScan access structure with specific bucket class. Additional parameters for the bucket class constructor can be passed.

Parameters:
parallelization - the number of paralllel buckets to create
bucketClass - the class of the storage bucket
bucketClassParams - additional parameters for the bucket class constructor in the name->value form
Throws:
java.lang.IllegalArgumentException - if
  • the provided bucketClass is not a part of LocalBucket hierarchy
  • the bucketClass does not have a proper constructor (String,long,long)
  • the correct constructor of bucketClass is not accesible
  • the constuctor of bucketClass has failed

ParallelSequentialScan

public ParallelSequentialScan(int parallelization,
                              java.lang.Class<? extends LocalBucket> bucketClass)
                       throws java.lang.IllegalArgumentException
Creates a new instance of ParallelSequentialScan access structure with specific bucket class.

Parameters:
parallelization - the number of paralllel buckets to create
bucketClass - the class of the storage bucket
Throws:
java.lang.IllegalArgumentException - if
  • the provided bucketClass is not a part of LocalBucket hierarchy
  • the bucketClass does not have a proper constructor (String,long,long)
  • the correct constructor of bucketClass is not accesible
  • the constuctor of bucketClass has failed

ParallelSequentialScan

public ParallelSequentialScan(int parallelization)
                       throws java.lang.IllegalArgumentException
Creates a new instance of ParallelSequentialScan access structure with MemoryStorageBucket as the storage class.

Parameters:
parallelization - the number of paralllel buckets to create
Throws:
java.lang.IllegalArgumentException - if
  • the provided bucketClass is not a part of LocalBucket hierarchy
  • the bucketClass does not have a proper constructor (String,long,long)
  • the correct constructor of bucketClass is not accesible
  • the constuctor of bucketClass has failed
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Description copied from class: Algorithm
Finalize the algorithm. All transient resources associated with this algorithm are released. After this method is called, the behavior of executing any operation is unpredictable.

Overrides:
finalize in class Algorithm
Throws:
java.lang.Throwable - if there was an error finalizing

destroy

public void destroy()
             throws java.lang.Throwable
Description copied from class: Algorithm
Destroy this algorithm. This method releases all resources (transient and persistent) associated with this algorithm. After this method is called, the behavior of executing any operation is unpredictable.

This implementation defaults to call Algorithm.finalize(), but should be overriden if the algorithm needs to differentiate between finalizing and destroying. In that case the "super.destroy()" should not be called if finalizing is not part of destroy.

Overrides:
destroy in class Algorithm
Throws:
java.lang.Throwable - if there was an error while cleaning

insert

public void insert(InsertOperation operation)
Inserts a new object.

Parameters:
operation - the insert operation which carries the object to be inserted.

insert

public void insert(BulkInsertOperation operation)
Inserts multiple new objects.

Parameters:
operation - the bulk-insert operation which carries the objects to be inserted.

delete

public void delete(DeleteOperation operation)
            throws BucketStorageException
Deletes an object.

Parameters:
operation - the delete operation which specifies the object to be deleted.
Throws:
BucketStorageException - if the low occupation limit is reached when deleting object

delete

public void delete(DeleteByLocatorOperation operation)
            throws BucketStorageException
Deletes objects by locators.

Parameters:
operation - the delete operation which specifies the locators of objects to be deleted
Throws:
BucketStorageException - if the low occupation limit is reached when deleting object

search

public void search(QueryOperation<?> operation)
            throws java.lang.CloneNotSupportedException,
                   java.lang.InterruptedException
Performs a query operation.

Parameters:
operation - the query operation which is to be executed and which will received the result list.
Throws:
java.lang.CloneNotSupportedException - if the operation does not support clonning (and thus cannot be used in parallel)
java.lang.InterruptedException - if the processing thread was interrupted during processing

toString

public java.lang.String toString()
Shows the information about this algorithm.

Overrides:
toString in class java.lang.Object
Returns:
the information about this algorithm