initialize
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using com.itac.mes.proxy.business;
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
|
||||
public class ThreadTemplate<T>
|
||||
{
|
||||
protected readonly OIBEventHandler _eventHandler;
|
||||
protected readonly T _request;
|
||||
|
||||
public ThreadTemplate(OIBEventHandler eventHandler, T request)
|
||||
{
|
||||
_eventHandler = eventHandler;
|
||||
_request = request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the event handler. By calling a funcion at the eventHandler the object is serialized and transported to java receiver.
|
||||
/// </summary>
|
||||
/// <returns>The event handler instance</returns>
|
||||
/// <exception>An exception is thrown when the handler was not set to this instance of thread template</exception>
|
||||
public OIBEventHandler getEventHandler()
|
||||
{
|
||||
if (_eventHandler == null)
|
||||
{
|
||||
if (_request == null) { throw new Exception("missing event handler to transport unknown message"); }
|
||||
throw new Exception("missing event handler to transport message of type " + _request.GetType().Name);
|
||||
}
|
||||
return _eventHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user