1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 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.common.procedure.adapter;
14 import org.simantics.db.procedure.Listener;
17 * Use this listener to ensure caching for a request. This listener will not lock the request in cache.
20 final public class CacheListener<T> implements Listener<T> {
22 final private ListenerSupport support;
24 public CacheListener(ListenerSupport support) {
25 this.support = support;
29 final public void exception(Throwable throwable) {
30 support.exception(throwable);
34 final public boolean isDisposed() {
35 return support.isDisposed();
39 public void execute(T result) {
43 public int hashCode() {
44 return support.hashCode();
48 public boolean equals(Object object) {
51 else if (object == null)
53 else if (CacheListener.class != object.getClass())
55 CacheListener<?> r = (CacheListener<?>)object;
56 return r.support.equals(support);