1*a046d00fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*a046d00fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*a046d00fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*a046d00fSAndrew Rist * distributed with this work for additional information 6*a046d00fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*a046d00fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*a046d00fSAndrew Rist * "License"); you may not use this file except in compliance 9*a046d00fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*a046d00fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*a046d00fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*a046d00fSAndrew Rist * software distributed under the License is distributed on an 15*a046d00fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*a046d00fSAndrew Rist * KIND, either express or implied. See the License for the 17*a046d00fSAndrew Rist * specific language governing permissions and limitations 18*a046d00fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*a046d00fSAndrew Rist *************************************************************/ 21*a046d00fSAndrew Rist 22*a046d00fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package com.sun.star.lib.util; 25cdf0e10cSrcweir 26cdf0e10cSrcweir /** 27cdf0e10cSrcweir * Optional interface to be implemented by objects stored in a 28cdf0e10cSrcweir * <code>WeakMap</code>. 29cdf0e10cSrcweir * 30cdf0e10cSrcweir * @see WeakMap 31cdf0e10cSrcweir */ 32cdf0e10cSrcweir public interface DisposeNotifier { 33cdf0e10cSrcweir /** 34cdf0e10cSrcweir * Adds a dispose listener, to be notified when this object is disposed. 35cdf0e10cSrcweir * 36cdf0e10cSrcweir * <p>It is unspecified what happens when the same listener is added 37cdf0e10cSrcweir * multiple times.</p> 38cdf0e10cSrcweir * 39cdf0e10cSrcweir * <p>It is unspecified exactly when the <code>notifyDispose</code> callback 40cdf0e10cSrcweir * is fired: immediately before the notifier is disposed, while it is in the 41cdf0e10cSrcweir * process of disposing, or some time after it got disposed. But even if 42cdf0e10cSrcweir * adding a listener to an already disposed notifer, the listener must 43cdf0e10cSrcweir * eventually receive a <code>notifyDispose</code> callback.</p> 44cdf0e10cSrcweir * 45cdf0e10cSrcweir * @param listener a dispose listener, to be notified when this object is 46cdf0e10cSrcweir * disposed; must not be <code>null</code> 47cdf0e10cSrcweir */ addDisposeListener(DisposeListener listener)48cdf0e10cSrcweir void addDisposeListener(DisposeListener listener); 49cdf0e10cSrcweir } 50