X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fservice%2FLifecycleSupport.java;h=26dd05da4e25b69d79da79526e0a60e552e8e6da;hp=e911cbe3efa7f450082beff8545799a9802d52fb;hb=HEAD;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/LifecycleSupport.java b/bundles/org.simantics.db/src/org/simantics/db/service/LifecycleSupport.java index e911cbe3e..26dd05da4 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/service/LifecycleSupport.java +++ b/bundles/org.simantics.db/src/org/simantics/db/service/LifecycleSupport.java @@ -1,78 +1,78 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.service; - -import org.simantics.db.SessionManager; -import org.simantics.db.SessionReference; -import org.simantics.db.exception.DatabaseException; - -public interface LifecycleSupport { - - public enum LifecycleState { - CREATING, ALIVE, CLOSING, CLOSED - } - - public interface LifecycleListener { - void stateChanged(LifecycleState newState); - } - - /** - * Get session reference - * @return session reference - */ - SessionReference getSessionReference(); - - /** - * @return the SessionManager that created this Session. - */ - SessionManager getSessionManager(); - - /** - * @return true if session is closed and thus no longer usable - */ - boolean isClosing(); - boolean isClosed(); - - void addListener(LifecycleListener listener); - void removeListener(LifecycleListener listener); - - /** - * Close this database session. - * This should also dispose any Disposable services registered - * into this ServiceLocator. - * - * @param timeout maximum time to wait for prerequisites for close to become true. - * If negative waits indefinitely. If zero polls. Time is given in milliseconds. - * @param force If true close session after timeout even if transactions are still active. - * If false throws TimeoutException if transactions are still active. - * @throws DatabaseException - */ - void close(long timeout, boolean force) - throws DatabaseException; - - /** - * Same as close(0, false). - */ - void close() - throws DatabaseException; - - /** - * - * @return identifier that can be used to reconnect if the session was - * not closed gracefully. SessionManagerSource.NullSessionId if closed - * gracefully. - */ - long getId(); - - void ping() - throws DatabaseException; -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.service; + +import org.simantics.db.SessionManager; +import org.simantics.db.SessionReference; +import org.simantics.db.exception.DatabaseException; + +public interface LifecycleSupport { + + public enum LifecycleState { + CREATING, ALIVE, CLOSING, CLOSED + } + + public interface LifecycleListener { + void stateChanged(LifecycleState newState); + } + + /** + * Get session reference + * @return session reference + */ + SessionReference getSessionReference(); + + /** + * @return the SessionManager that created this Session. + */ + SessionManager getSessionManager(); + + /** + * @return true if session is closed and thus no longer usable + */ + boolean isClosing(); + boolean isClosed(); + + void addListener(LifecycleListener listener); + void removeListener(LifecycleListener listener); + + /** + * Close this database session. + * This should also dispose any Disposable services registered + * into this ServiceLocator. + * + * @param timeout maximum time to wait for prerequisites for close to become true. + * If negative waits indefinitely. If zero polls. Time is given in milliseconds. + * @param force If true close session after timeout even if transactions are still active. + * If false throws TimeoutException if transactions are still active. + * @throws DatabaseException + */ + void close(long timeout, boolean force) + throws DatabaseException; + + /** + * Same as close(0, false). + */ + void close() + throws DatabaseException; + + /** + * + * @return identifier that can be used to reconnect if the session was + * not closed gracefully. SessionManagerSource.NullSessionId if closed + * gracefully. + */ + long getId(); + + void ping() + throws DatabaseException; +}