01: /*
02:
03: Derby - Class org.apache.derby.impl.store.raw.data.SyncOnCommit
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: 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 and
18: 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 commit
47: */
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 "
61: + this );
62: }
63:
64: if (arg.equals(RawTransaction.COMMIT)) {
65: openContainerAndDoIt((RawTransaction) obj);
66: }
67:
68: // remove this object if we are commiting, aborting or the container is being dropped
69: if (arg.equals(RawTransaction.COMMIT)
70: || arg.equals(RawTransaction.ABORT)
71: || arg.equals(identity)) {
72: obj.deleteObserver(this );
73: }
74: }
75:
76: /**
77: @exception StandardException Standard Cloudscape error policy
78: */
79: protected void doIt(BaseContainerHandle handle)
80: throws StandardException {
81: handle.container.flushAll();
82: }
83: }
|