1 24 25 package org.objectweb.cjdbc.controller.backend; 26 27 import java.sql.SQLException ; 28 29 import org.objectweb.cjdbc.common.log.Trace; 30 import org.objectweb.cjdbc.controller.recoverylog.BackendRecoveryInfo; 31 import org.objectweb.cjdbc.controller.recoverylog.RecoveryLog; 32 33 39 public class BackendStateListener 40 { 41 42 Trace logger = Trace.getLogger(BackendStateListener.class 43 .getName()); 44 private String virtualDatabaseName; 45 private RecoveryLog recoveryLog; 46 47 53 public BackendStateListener(String vdbName, RecoveryLog recoveryLog) 54 { 55 this.virtualDatabaseName = vdbName; 56 this.recoveryLog = recoveryLog; 57 } 58 59 64 public synchronized void changeState(DatabaseBackend backend) 65 { 66 try 67 { 68 recoveryLog.storeBackendRecoveryInfo(virtualDatabaseName, 69 new BackendRecoveryInfo(backend.getName(), backend 70 .getLastKnownCheckpoint(), backend.getStateValue(), 71 virtualDatabaseName)); 72 } 73 catch (SQLException e) 74 { 75 logger.error("Could not store informatione for backend:" 76 + backend.getName(), e); 77 } 78 } 79 } | Popular Tags |