Class DefaultReshapeListener
- java.lang.Object
-
- com.levigo.jadice.server.documentplatform.DefaultReshapeListener
-
- All Implemented Interfaces:
ReshapeListener
public class DefaultReshapeListener extends Object implements ReshapeListener
A simpleReshapeListener
the logs the progress of theReshapeWorker
.In order not to flood the logging files the more pages a document has the less progress is logged. The progress is logged only if one the two conditions is met:
- Since:
- jadice server 5.4.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.levigo.jadice.server.documentplatform.ReshapeListener
ReshapeListener.Context
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_MINIMUM_LOG_INTERVAL
The default minimum interval in which the logging shall be performed.
-
Constructor Summary
Constructors Constructor Description DefaultReshapeListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
done(ReshapeListener.Context context)
Called each time a reshape process is successfully completed.void
failed(ReshapeListener.Context context, Exception cause)
Called each time a reshape process is unsuccessfully terminated.long
getLogInterval()
protected static boolean
isRelevantIndex(int idx)
Check if a page index is relevant for logging.void
pageDone(ReshapeListener.Context context, com.levigo.jadice.document.Page page)
Called each time a reshape process successfully finishes reshaping aPage
.void
pageFailed(ReshapeListener.Context context, com.levigo.jadice.document.Page page, Exception cause)
Called each time a reshape process unsuccessfully terminates reshaping aPage
.void
pageStarted(ReshapeListener.Context ctx, com.levigo.jadice.document.Page page)
Called each time a reshape process starts reshaping aPage
.void
setLogInterval(long logInterval)
Set the minimum time interval for which the logging events shall be generated.void
started(ReshapeListener.Context context)
Called when a reshape process is started.
-
-
-
Method Detail
-
pageStarted
public void pageStarted(ReshapeListener.Context ctx, com.levigo.jadice.document.Page page)
Description copied from interface:ReshapeListener
Called each time a reshape process starts reshaping aPage
.- Specified by:
pageStarted
in interfaceReshapeListener
- Parameters:
ctx
- theReshapeListener.Context
of this actionpage
- the current page being reshaped
-
isRelevantIndex
protected static boolean isRelevantIndex(int idx)
Check if a page index is relevant for logging.This algorithm uses a logarithmic threshold, i.e.
- for the first 10 pages every index is relevant,
- for the pages 10 to 99 only every tenth page is relevant,
- for the pages 100 to 999 only every 100th page is relevant,
- and so on.
- Parameters:
idx
- the page index- Returns:
true
iff the given index is relevant
-
getLogInterval
public long getLogInterval()
-
setLogInterval
public void setLogInterval(long logInterval)
Set the minimum time interval for which the logging events shall be generated.- Parameters:
logInterval
- minimum time interval for which the logging events shall be generated
-
started
public void started(ReshapeListener.Context context)
Description copied from interface:ReshapeListener
Called when a reshape process is started.- Specified by:
started
in interfaceReshapeListener
- Parameters:
context
- theReshapeListener.Context
of this action
-
done
public void done(ReshapeListener.Context context)
Description copied from interface:ReshapeListener
Called each time a reshape process is successfully completed.- Specified by:
done
in interfaceReshapeListener
- Parameters:
context
- theReshapeListener.Context
of this action
-
failed
public void failed(ReshapeListener.Context context, Exception cause)
Description copied from interface:ReshapeListener
Called each time a reshape process is unsuccessfully terminated.- Specified by:
failed
in interfaceReshapeListener
- Parameters:
context
- theReshapeListener.Context
of this actioncause
- gives the reason for the unsuccessful termination
-
pageDone
public void pageDone(ReshapeListener.Context context, com.levigo.jadice.document.Page page)
Description copied from interface:ReshapeListener
Called each time a reshape process successfully finishes reshaping aPage
.- Specified by:
pageDone
in interfaceReshapeListener
- Parameters:
context
- theReshapeListener.Context
of this actionpage
- the page being reshaped
-
pageFailed
public void pageFailed(ReshapeListener.Context context, com.levigo.jadice.document.Page page, Exception cause)
Description copied from interface:ReshapeListener
Called each time a reshape process unsuccessfully terminates reshaping aPage
.- Specified by:
pageFailed
in interfaceReshapeListener
- Parameters:
context
- theReshapeListener.Context
of this actionpage
- the page being reshapedcause
- gives the reason for the unsuccessful termination
-
-