Package com.logicaldoc.core.threading

# Class NotifyingThread<T>

java.lang.Object
com.logicaldoc.core.threading.NotifyingThread<T>

Type Parameters:
  `T` - the type of callable

All Implemented Interfaces:
  `Callable<T>`

public class NotifyingThread<T> extends Object implements Callable<T>
A Thread that notifies it's listeners about the end of the elaboration and also measures the execution time.

Since:
  8.5.3
Author:
  Marco Meschieri - LogicalDOC

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`NotifyingThread.ThreadCompleteListener<T>`
Interface to be implemented by the listeners

## Constructor Summary

Constructors
Constructor
Description
`NotifyingThread(String name)`
`NotifyingThread(Callable<T> wrappedCallable, String name)`

## Method Summary

Modifier and Type
Method
Description
`final void`
`addListener(NotifyingThread.ThreadCompleteListener<T> listener)`
`final T`
`call()`
`T`
`doRun()`
Concrete implementations should override this method to implement their own processing.
`long`
`getElapsedTime()`
Gets the elapsed time since the begin of the execution until now o until the end of the thread's execution
`Throwable`
`getError()`
`String`
`getName()`
`boolean`
`isOver()`
Checks if the thread has finished
`final void`
`removeListener(NotifyingThread.ThreadCompleteListener<T> listener)`
`void`
`setName(String name)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### NotifyingThread

public NotifyingThread(String name)

### NotifyingThread

public NotifyingThread(Callable<T> wrappedCallable, String name)

## Method Details

### addListener

public final void addListener(NotifyingThread.ThreadCompleteListener<T> listener)

### removeListener

public final void removeListener(NotifyingThread.ThreadCompleteListener<T> listener)

### getName

public String getName()

### setName

public void setName(String name)

### getElapsedTime

public long getElapsedTime()
Gets the elapsed time since the begin of the execution until now o until the end of the thread's execution

Returns:
  the elapsed time in milliseconds

### isOver

public boolean isOver()
Checks if the thread has finished

Returns:
  if the it has finished

### call

public final T call()

Specified by:
  `call` in interface `Callable<T>`

### doRun

public T doRun()
Concrete implementations should override this method to implement their own processing.

### getError

public Throwable getError()