1 /*2 3 Derby - Class org.apache.derby.impl.store.raw.data.SyncOnCommit4 5 Licensed to the Apache Software Foundation (ASF) under one or more6 contributor license agreements. See the NOTICE file distributed with7 this work for additional information regarding copyright ownership.8 The ASF licenses this file to you under the Apache License, Version 2.09 (the "License"); you may not use this file except in compliance with10 the License. You may obtain a copy of the License at11 12 http://www.apache.org/licenses/LICENSE-2.013 14 Unless required by applicable law or agreed to in writing, software15 distributed under the License is distributed on an "AS IS" BASIS,16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.17 See the License for the specific language governing permissions and18 limitations under the License.19 20 */21 22 package org.apache.derby.impl.store.raw.data;23 24 import org.apache.derby.iapi.store.raw.ContainerHandle;25 import org.apache.derby.iapi.store.raw.ContainerLock;26 import org.apache.derby.iapi.store.raw.Page;27 import org.apache.derby.iapi.store.raw.LockingPolicy;28 import org.apache.derby.iapi.store.raw.RecordHandle;29 import org.apache.derby.iapi.store.raw.ContainerKey;30 31 import org.apache.derby.iapi.store.raw.data.RawContainerHandle;32 import org.apache.derby.iapi.store.raw.log.LogInstant;33 import org.apache.derby.iapi.store.raw.xact.RawTransaction;34 35 import org.apache.derby.iapi.services.locks.Lockable;36 37 import org.apache.derby.catalog.UUID;38 39 import org.apache.derby.iapi.error.StandardException;40 41 import org.apache.derby.iapi.services.sanity.SanityManager;42 43 import java.util.Observable ;44 45 /**46 Flush all pages for a table on a commit47 */48 49 public class SyncOnCommit extends ContainerHandleActionOnCommit {50 51 public SyncOnCommit(ContainerKey identity) {52 53 super(identity);54 }55 56 public void update(Observable obj, Object arg) {57 58 if (SanityManager.DEBUG) {59 if (arg == null)60 SanityManager.THROWASSERT("still on observr list " + this);61 }62 63 if (arg.equals(RawTransaction.COMMIT)) {64 openContainerAndDoIt((RawTransaction) obj);65 }66 67 // remove this object if we are commiting, aborting or the container is being dropped68 if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)69 || arg.equals(identity)) {70 obj.deleteObserver(this);71 }72 }73 74 /**75 @exception StandardException Standard Cloudscape error policy76 */77 protected void doIt(BaseContainerHandle handle)78 throws StandardException {79 handle.container.flushAll();80 }81 }82