-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mainly making management controllers to block on the storage manager
- Loading branch information
1 parent
ef16dc7
commit 2d14d92
Showing
19 changed files
with
1,767 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/main/org/hornetq/core/management/impl/AbstractControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright 2009 Red Hat, Inc. | ||
* Red Hat licenses this file to you under the Apache License, version | ||
* 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package org.hornetq.core.management.impl; | ||
|
||
import javax.management.NotCompliantMBeanException; | ||
import javax.management.StandardMBean; | ||
|
||
import org.hornetq.core.persistence.StorageManager; | ||
|
||
/** | ||
* A AbstractControl | ||
* | ||
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a> | ||
* | ||
* | ||
*/ | ||
public abstract class AbstractControl extends StandardMBean | ||
{ | ||
|
||
// Constants ----------------------------------------------------- | ||
|
||
// Attributes ---------------------------------------------------- | ||
|
||
protected final StorageManager storageManager; | ||
|
||
// Static -------------------------------------------------------- | ||
|
||
// Constructors -------------------------------------------------- | ||
|
||
public AbstractControl(Class<?> clazz, StorageManager storageManager) throws NotCompliantMBeanException | ||
{ | ||
super(clazz); | ||
this.storageManager = storageManager; | ||
} | ||
|
||
// Public -------------------------------------------------------- | ||
|
||
// Package protected --------------------------------------------- | ||
|
||
// Protected ----------------------------------------------------- | ||
|
||
protected void clearIO() | ||
{ | ||
// the storage manager could be null on the backup on certain components | ||
if (storageManager != null) | ||
{ | ||
storageManager.clearContext(); | ||
} | ||
} | ||
|
||
protected void blockOnIO() | ||
{ | ||
// the storage manager could be null on the backup on certain components | ||
if (storageManager != null) | ||
{ | ||
try | ||
{ | ||
storageManager.waitOnOperations(); | ||
storageManager.clearContext(); | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new RuntimeException(e.getMessage(), e); | ||
} | ||
} | ||
|
||
} | ||
|
||
// Private ------------------------------------------------------- | ||
|
||
// Inner classes ------------------------------------------------- | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.