Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class RequestLifeCycle
{

/** The current stack. */
private static ThreadLocal<RequestLifeCycleStack> current = new ThreadLocal<RequestLifeCycleStack>();
private static ThreadLocal<RequestLifeCycleStack> current = new ThreadLocal<>();

/** The components of this life cycle. */
private List<ComponentRequestLifecycle> components;
Expand All @@ -59,7 +59,7 @@ void doBegin()

IdentityHashMap<Object, Throwable> doEnd()
{
IdentityHashMap<Object, Throwable> result = new IdentityHashMap<Object, Throwable>();
IdentityHashMap<Object, Throwable> result = new IdentityHashMap<>();

//
for (ComponentRequestLifecycle componentRLF : components)
Expand Down Expand Up @@ -152,26 +152,23 @@ public static void begin(ExoContainer container)
* @throws IllegalStateException if no container life cycle is associated with this thread
* @return the result map
*/
public static Map<Object, Throwable> end() throws IllegalStateException
{
RequestLifeCycleStack lf = current.get();
if (lf == null)
{
throw new IllegalStateException();
}
Map<Object, Throwable> result = lf.end();
if (lf.isEmpty())
{
current.set(null);
}
return result;
public static Map<Object, Throwable> end() throws IllegalStateException {
RequestLifeCycleStack lf = current.get();
if (lf == null) {
throw new IllegalStateException();
}
Map<Object, Throwable> result = lf.end();
if (lf.isEmpty()) {
current.remove();
}
return result;
}

protected void restartTransaction() {
public static void restartTransaction() {
restartTransaction(ExoContainerContext.getCurrentContainer());
}

protected void restartTransaction(ExoContainer container) {
public static void restartTransaction(ExoContainer container) {
int i = 0;
// Close transactions until no encapsulated transaction
boolean success = true;
Expand Down Expand Up @@ -202,7 +199,7 @@ public static boolean isStarted(ComponentRequestLifecycle lifeCycle) {
throw new IllegalArgumentException("The lifeCycle cannot be null");
}
RequestLifeCycleStack lf = current.get();
return lf == null ? false : lf.isStarted(lifeCycle);
return lf != null && lf.isStarted(lifeCycle);
}

/**
Expand All @@ -217,6 +214,6 @@ public static boolean isStarted(ExoContainer container, boolean local){
throw new IllegalArgumentException("The container cannot be null");
}
RequestLifeCycleStack lf = current.get();
return lf== null ? false : lf.isStarted(container, local);
}
return lf != null && lf.isStarted(container, local);
}
}