container/profiles/src/main/java/org/mobicents/slee/container/profile/ProfileObjectImpl.java
public void setProfileContext(ProfileContextImpl profileContext) {
		
		if(logger.isTraceEnabled()) {
			logger.trace("[setProfileContext] "+this);
		}

		if (profileContext == null) {
			throw new NullPointerException("Passed context must not be null.");
		}
		
		if (state != ProfileObjectState.DOES_NOT_EXIST) {
			throw new IllegalStateException("Wrong state: " + this.state + ",on profile set context operation, for profile table: "
					+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID());
		}

		this.profileContext = profileContext;
		this.profileContext.setProfileObject(this);
		
		if (profileConcreteClassInfo.isInvokeSetProfileContext()) {
			final ClassLoader oldClassLoader = SleeContainerUtils.getCurrentThreadClassLoader();

			try {
				final ClassLoader cl = this.profileTable.getProfileSpecificationComponent().getClassLoader();

				if (System.getSecurityManager()!=null) {
					AccessController.doPrivileged(new PrivilegedAction<Object>() {
						public Object run() {
							Thread.currentThread().setContextClassLoader(cl);
							return null;
						}
					});
				}
				else {
					Thread.currentThread().setContextClassLoader(cl);
				}

				try {
					if (isSlee11) {
						try {
							profileConcrete.setProfileContext(profileContext);
						}
						catch (RuntimeException e) {
							runtimeExceptionOnProfileInvocation(e);
						}
					}
				}
				catch (Exception e) {
					if (logger.isDebugEnabled())
						logger.debug("Exception encountered while setting profile context for profile table: "
								+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID(), e);
				}			
			}
			finally {
				if (System.getSecurityManager()!=null) {
					AccessController.doPrivileged(new PrivilegedAction<Object>() {
						public Object run() {
							Thread.currentThread().setContextClassLoader(oldClassLoader);
							return null;
						}
					});
				}
				else {
					Thread.currentThread().setContextClassLoader(oldClassLoader);
				}
			}
		}
		
		state = ProfileObjectState.POOLED;

	}
public void setProfileContext(ProfileContextImpl profileContext) {
		
		if(logger.isTraceEnabled()) {
			logger.trace("[setProfileContext] "+this);
		}

		if (profileContext == null) {
			throw new NullPointerException("Passed context must not be null.");
		}
		
		if (state != ProfileObjectState.DOES_NOT_EXIST) {
			throw new IllegalStateException("Wrong state: " + this.state + ",on profile set context operation, for profile table: "
					+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID());
		}

		this.profileContext = profileContext;
		this.profileContext.setProfileObject(this);
		
		if (profileConcreteClassInfo.isInvokeSetProfileContext()) {
			final ClassLoader oldClassLoader = SleeContainerUtils.getCurrentThreadClassLoader();

			try {
				final ClassLoader cl = this.profileTable.getProfileSpecificationComponent().getClassLoader();

				if (System.getSecurityManager()!=null) {
					AccessController.doPrivileged(new PrivilegedAction<Object>() {
						public Object run() {
							Thread.currentThread().setContextClassLoader(cl);
							return null;
						}
					});
				}
				else {
					Thread.currentThread().setContextClassLoader(cl);
				}

				try {
					if (isSlee11) {
						try {
							profileConcrete.setProfileContext(profileContext);
						}
						catch (RuntimeException e) {
							runtimeExceptionOnProfileInvocation(e);
						}
					}
				}
				catch (Exception e) {
					if (logger.isDebugEnabled())
						logger.debug("Exception encountered while setting profile context for profile table: "
								+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID(), e);
				}			
			}
			finally {
				if (System.getSecurityManager()!=null) {
					AccessController.doPrivileged(new PrivilegedAction<Object>() {
						public Object run() {
							Thread.currentThread().setContextClassLoader(oldClassLoader);
							return null;
						}
					});
				}
				else {
					Thread.currentThread().setContextClassLoader(oldClassLoader);
				}
			}
		}
		
		state = ProfileObjectState.POOLED;

	}
public void setProfileContext ( ProfileContextImpl profileContext ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "[setProfileContext] " + this ) ; } if ( profileContext == null ) { throw new NullPointerException ( "Passed context must not be null." ) ; } if ( state != ProfileObjectState . DOES_NOT_EXIST ) { throw new IllegalStateException ( "Wrong state: " + this . state + ",on profile set context operation, for profile table: " + this . profileTable . getProfileTableName ( ) + " with specification: " + this . profileTable . getProfileSpecificationComponent ( ) . getProfileSpecificationID ( ) ) ; } this . profileContext = profileContext ; this . profileContext . setProfileObject ( this ) ; if ( profileConcreteClassInfo . isInvokeSetProfileContext ( ) ) { final ClassLoader oldClassLoader = SleeContainerUtils . getCurrentThreadClassLoader ( ) ; try { final ClassLoader cl = this . profileTable . getProfileSpecificationComponent ( ) . getClassLoader ( ) ; if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; } try { if ( isSlee11 ) { try { profileConcrete . setProfileContext ( profileContext ) ; } catch ( RuntimeException e ) { runtimeExceptionOnProfileInvocation ( e ) ; } } } catch ( Exception e ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Exception encountered while setting profile context for profile table: " + this . profileTable . getProfileTableName ( ) + " with specification: " + this . profileTable . getProfileSpecificationComponent ( ) . getProfileSpecificationID ( ) , e ) ; } } finally { if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; } } } state = ProfileObjectState . POOLED ; }
Invoked from pool.

@param profileContext
Invoked from pool .