1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.management;
\r
14 import java.util.concurrent.TimeoutException;
\r
16 import org.simantics.db.Session;
\r
17 import org.simantics.utils.datastructures.disposable.IDisposable;
\r
18 import org.simantics.utils.datastructures.hints.IHintContext;
\r
21 * A container for a database session. Also hosts a hint context that can be
\r
22 * used to carry arbitrary values around. A server activation can be attached to
\r
23 * an ISessionContext for information value only - ISessionContext will never
\r
24 * dispose or do anything else with it.
\r
27 * Disposal of an ISessionContext closes the session contained by this context.
\r
28 * Further use of this context is prohibited.
\r
31 * @author Tuukka Lehtonen
\r
33 public interface ISessionContext extends IDisposable, IHintContext {
\r
35 void close() throws IllegalStateException, InterruptedException, TimeoutException;
\r
38 // * @return the socket address this session is connected to
\r
40 // IServerAddress getAddress();
\r
43 * @return the database session contained by this context
\r
44 * @throws IllegalStateException if this context has been disposed
\r
46 Session getSession();
\r
49 * @return the database session contained by this context or
\r
50 * <code>null</code> if session context has already been disposed.
\r
52 Session peekSession();
\r