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