src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/ThreadLocalContainerResolver.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 44,81 ****
* }
* </pre>
* @since 2.2.7
*/
public class ThreadLocalContainerResolver extends ContainerResolver {
! private ThreadLocal<Container> containers = new ThreadLocal<Container>() {
@Override
protected Container initialValue() {
return Container.NONE;
}
};
public Container getContainer() {
! return containers.get();
}
/**
* Enters container
* @param container Container to set
* @return Previous container; must be remembered and passed to exitContainer
*/
public Container enterContainer(Container container) {
! Container old = containers.get();
! containers.set(container);
return old;
}
/**
* Exits container
* @param old Container returned from enterContainer
*/
public void exitContainer(Container old) {
! containers.set(old);
}
/**
* Used by {@link com.sun.xml.internal.ws.api.pipe.Engine} to wrap asynchronous {@link com.sun.xml.internal.ws.api.pipe.Fiber} executions
* @param container Container
--- 44,81 ----
* }
* </pre>
* @since 2.2.7
*/
public class ThreadLocalContainerResolver extends ContainerResolver {
! private ThreadLocal<Container> containerThreadLocal = new ThreadLocal<Container>() {
@Override
protected Container initialValue() {
return Container.NONE;
}
};
public Container getContainer() {
! return containerThreadLocal.get();
}
/**
* Enters container
* @param container Container to set
* @return Previous container; must be remembered and passed to exitContainer
*/
public Container enterContainer(Container container) {
! Container old = containerThreadLocal.get();
! containerThreadLocal.set(container);
return old;
}
/**
* Exits container
* @param old Container returned from enterContainer
*/
public void exitContainer(Container old) {
! containerThreadLocal.set(old);
}
/**
* Used by {@link com.sun.xml.internal.ws.api.pipe.Engine} to wrap asynchronous {@link com.sun.xml.internal.ws.api.pipe.Fiber} executions
* @param container Container