001package org.apache.commons.jcs3.utils.access; 002 003import java.util.concurrent.atomic.AtomicBoolean; 004 005/* 006 * Licensed to the Apache Software Foundation (ASF) under one 007 * or more contributor license agreements. See the NOTICE file 008 * distributed with this work for additional information 009 * regarding copyright ownership. The ASF licenses this file 010 * to you under the Apache License, Version 2.0 (the 011 * "License"); you may not use this file except in compliance 012 * with the License. You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, 017 * software distributed under the License is distributed on an 018 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 019 * KIND, either express or implied. See the License for the 020 * specific language governing permissions and limitations 021 * under the License. 022 */ 023 024/** 025 * This is an abstract template for JCSWorkerHelper implementations. it simple has a convenience 026 * method for setting the finished flag. 027 */ 028public abstract class AbstractJCSWorkerHelper<V> implements JCSWorkerHelper<V> 029{ 030 /** finished flag. Can't we use wait notify? */ 031 private final AtomicBoolean finished = new AtomicBoolean(false); 032 033 /** 034 * Default 035 */ 036 public AbstractJCSWorkerHelper() 037 { 038 } 039 040 /** 041 * @return finished 042 */ 043 @Override 044 public boolean isFinished() 045 { 046 return finished.get(); 047 } 048 049 /** 050 * @param isFinished 051 */ 052 @Override 053 public void setFinished( final boolean isFinished ) 054 { 055 finished.set(isFinished); 056 } 057}