openlsd.multiple.ophandler.LSDOpHandler Class Reference

Collaboration diagram for openlsd.multiple.ophandler.LSDOpHandler:

Collaboration graph
[legend]

List of all members.


Detailed Description

This class implements the Op Handler which is responsible of Delete, Import, Check in asynchronous mode with other OpenLSD Server that are mirror from a principal one.
Author:
Frederic BREGIER LGPL 2007

Public Member Functions

 LSDOpHandler (LSDLoadConfig llc)

Static Public Member Functions

static void main (String[] args)
static void addWriteFile (LSDDbOp newop)
static void flushFile ()
static void terminate (boolean exit)
static void terminate ()

Static Public Attributes

static Boolean stillRun = Boolean.TRUE
static FileOutputStream fileExport = null
static LSDOpHandlerHttpIoHandler opHandlerHttpIoHandler = null

Protected Member Functions

void producerConsummer (Semaphore startSignal, Semaphore doneSignal)

Protected Attributes

LSDDbAdmin admin = null
LSDDbAdmin[] admins = null
LSDLoadConfig llc = null
ConcurrentLinkedQueue
< ArrayList< LSDDbOp > > 
todoQueue = null
int nbthread = 1
String extStop = null
long delay = LSDConstants.RETRYINMS
LSDPoolLSDConnection poolLSDConnection = null
long numberStep = 10
boolean multipleDB = true

Static Protected Attributes

static String doExportOp = null

Private Member Functions

int initializeArgs (String[] args, int curargs)
void runOpHandler ()
long incrementFile (long reuseExport)
void finalizeConnection ()

Static Private Member Functions

static boolean trueCreateNewFile ()
static boolean createNewFile ()
static boolean closeFile ()
static void initSignalHandler ()

Static Private Attributes

static long rankExport = 0
static final String extensionTempFileExport = ".export.temp"
static final String extensionFileExport = ".export"
static Thread hook = null

Constructor & Destructor Documentation

openlsd.multiple.ophandler.LSDOpHandler.LSDOpHandler ( LSDLoadConfig  llc  ) 

Constructor

Parameters:
llc 


Member Function Documentation

int openlsd.multiple.ophandler.LSDOpHandler.initializeArgs ( String[]  args,
int  curargs 
) [private]

Get arguments

Parameters:
args 
curargs 
Returns:
the next current rank

static void openlsd.multiple.ophandler.LSDOpHandler.main ( String[]  args  )  [static]

Start the Op Handler with the configdb filename as first argument, then:
-nbthread nbthread to specify how many thread will be used
-stop filepath (mandatory) to specify what is the stop file (the existence of this file stops the process)
-delay time in ms to specify the delay between two scans of database
-exportop filepath to specify the path/filename where rank.export will be added as export of operation logs to enable redo operation on copied databases if any for ML support with database replication. The file format is "idip;op;lid;sid;did" where idip is the id of one ML LSD Server, op is 2 for insert, 3 for delete.
-nbstep numberStep to set a limit on number of files referenced in exoprtop file as numberStep*190*3*nbThread
-portctl port where OpHandler will listen in HTTP mode for administration
-passwd passwd OpHandler shutdown through HTTP will compare to this passwd (Mandatory if HTTP Admin interface is wanted)

Parameters:
args 

void openlsd.multiple.ophandler.LSDOpHandler.runOpHandler (  )  [private]

Run OpHandler

void openlsd.multiple.ophandler.LSDOpHandler.producerConsummer ( Semaphore  startSignal,
Semaphore  doneSignal 
) [protected]

Produce some work for Consummer
Get Op object from database where status = Todo and function = import or delete or others in asc order
If filestop is found then stop
When a delete or similar op is found, goes to sequential Mode; else does in multithreaded mode

Parameters:
startSignal 
doneSignal 

long openlsd.multiple.ophandler.LSDOpHandler.incrementFile ( long  reuseExport  )  [private]

Increment possibly the output file

Parameters:
reuseExport 
Returns:
the new reuseExport rank

static boolean openlsd.multiple.ophandler.LSDOpHandler.trueCreateNewFile (  )  [static, private]

Internal function to really create output file

Returns:
True if OK, else False

static boolean openlsd.multiple.ophandler.LSDOpHandler.createNewFile (  )  [static, private]

Close the previous temp file and create a new one

Returns:
True if OK, else False

static boolean openlsd.multiple.ophandler.LSDOpHandler.closeFile (  )  [static, private]

Close the final temp file

Returns:
true if OK, else false

static void openlsd.multiple.ophandler.LSDOpHandler.addWriteFile ( LSDDbOp  newop  )  [static]

Write the Op done to the export File

Parameters:
newop 

static void openlsd.multiple.ophandler.LSDOpHandler.flushFile (  )  [static]

Flush the export File

void openlsd.multiple.ophandler.LSDOpHandler.finalizeConnection (  )  [private]

Finalize any connections that are still opened.

static void openlsd.multiple.ophandler.LSDOpHandler.terminate ( boolean  exit  )  [static]

Terminate in case of Signal or Big error !

Parameters:
exit If True, will call System.exit

static void openlsd.multiple.ophandler.LSDOpHandler.terminate (  )  [static]

Terminate in case of Signal or Big error !

static void openlsd.multiple.ophandler.LSDOpHandler.initSignalHandler (  )  [static, private]

Signal Handler initialization: enables a better shutdown of socket


Member Data Documentation

DB Admin object

DB Admin objects for Executors

LoadConfig from file

ConcurrentLinkedQueue<ArrayList<LSDDbOp> > openlsd.multiple.ophandler.LSDOpHandler.todoQueue = null [protected]

Queue of id Op

Number of threads

File that stops the process when it exists for AutoImport

Boolean openlsd.multiple.ophandler.LSDOpHandler.stillRun = Boolean.TRUE [static]

True as long as the file that stops the process does not exist

Delay between two get in todo queue when no Op is available

String openlsd.multiple.ophandler.LSDOpHandler.doExportOp = null [static, protected]

Export info on files to redo SQL orders: path and filename where <rank>.export will be added

FileOutputStream openlsd.multiple.ophandler.LSDOpHandler.fileExport = null [static]

Current File of export

Cpt of file

Pool of connections

How many files * 190 * nbThread will be in the fileExport

Multiple DB Access support

HTTP Service

final String openlsd.multiple.ophandler.LSDOpHandler.extensionTempFileExport = ".export.temp" [static, private]

Extension of temp export file

final String openlsd.multiple.ophandler.LSDOpHandler.extensionFileExport = ".export" [static, private]

Extension of export file

Thread openlsd.multiple.ophandler.LSDOpHandler.hook = null [static, private]

Handler for Signal


The documentation for this class was generated from the following file: