]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/TransientCacheListener.java
More DB ListenerAdapter abstract to force isDisposed implementation
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / procedure / adapter / TransientCacheListener.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.common.procedure.adapter;
13
14 import org.simantics.db.procedure.Listener;
15
16 /*
17  * Use this listener to ensure caching for a request. This listener will not lock the request in cache.
18  * 
19  */
20 public class TransientCacheListener<T> implements Listener<T> {
21
22     @SuppressWarnings("rawtypes")
23     private static TransientCacheListener INSTANCE = new TransientCacheListener();
24
25     @SuppressWarnings("unchecked")
26     public static <T> TransientCacheListener<T> instance() {
27         return (TransientCacheListener<T>) INSTANCE;
28     }
29
30     @Override
31     public final boolean isDisposed() {
32         return true;
33     }
34
35     @Override
36     public int hashCode() {
37         return TransientCacheListener.class.hashCode();
38     }
39
40     @Override
41     public boolean equals(Object other) {
42         return other instanceof TransientCacheListener<?>;
43     }
44
45     @Override
46     public void execute(T result) {
47     }
48
49     @Override
50     public void exception(Throwable t) {
51     }
52
53 }