Object PulsarContexts
-
- All Implemented Interfaces:
public class PulsarContexts
-
-
Field Summary
Fields Modifier and Type Field Description private final PulsarContextactiveContextpublic final static PulsarContextsINSTANCE
-
Method Summary
Modifier and Type Method Description final static PulsarContextcreate()Create a new context, if there is already an active context, return it. final static PulsarContextcreate(PulsarContext context)Create a new context, if there is already an active context, return it. final static PulsarContextcreate(String contextLocation)Create a new context, if there is already an active context, return it. final static PulsarContextcreate(ApplicationContext applicationContext)Create a new context, if there is already an active context, return it. final static PulsarSessioncreateSession()Create a PulsarSession with the active context. final static PulsarSessiongetOrCreateSession()Create a PulsarSession with the active context. final static Unitawait()Wait for all submitted urls to be processed. final static UnitregisterClosable(AutoCloseable closable, Integer priority)Register a closable object to the active context. final static Unitshutdown()Close the all the created context. final PulsarContextgetActiveContext()The active context, it's the last created context. -
-
Method Detail
-
create
@Synchronized() final static PulsarContext create()
Create a new context, if there is already an active context, return it.
- Returns:
the created context
-
create
@Synchronized() final static PulsarContext create(PulsarContext context)
Create a new context, if there is already an active context, return it.
- Parameters:
context- the context to be created- Returns:
the created context
-
create
@Synchronized() final static PulsarContext create(String contextLocation)
Create a new context, if there is already an active context, return it.
- Parameters:
contextLocation- the location of the context- Returns:
the created context
-
create
@Synchronized() final static PulsarContext create(ApplicationContext applicationContext)
Create a new context, if there is already an active context, return it.
- Parameters:
applicationContext- the Spring application context- Returns:
the created context
-
createSession
@Synchronized() final static PulsarSession createSession()
Create a PulsarSession with the active context.
- Returns:
the created session
-
getOrCreateSession
@Synchronized() final static PulsarSession getOrCreateSession()
Create a PulsarSession with the active context.
- Returns:
the created session
-
registerClosable
final static Unit registerClosable(AutoCloseable closable, Integer priority)
Register a closable object to the active context. TODO: might fail before the context is created
- Parameters:
closable- the closable objectpriority- the priority of the closable object
-
shutdown
@Synchronized() final static Unit shutdown()
Close the all the created context.
-
getActiveContext
final PulsarContext getActiveContext()
The active context, it's the last created context.
-
-
-
-