Mercurial > hg > Database > Cassandra
comparison src/java/org/apache/cassandra/cache/AbstractCache.java @ 0:d485154379c8 default tip
apache-cassandra-0.6.0-rc1-src
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 02 Apr 2010 13:36:02 +0900 (2010-04-02) |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d485154379c8 |
---|---|
1 package org.apache.cassandra.cache; | |
2 /* | |
3 * | |
4 * Licensed to the Apache Software Foundation (ASF) under one | |
5 * or more contributor license agreements. See the NOTICE file | |
6 * distributed with this work for additional information | |
7 * regarding copyright ownership. The ASF licenses this file | |
8 * to you under the Apache License, Version 2.0 (the | |
9 * "License"); you may not use this file except in compliance | |
10 * with 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, | |
15 * software distributed under the License is distributed on an | |
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 * KIND, either express or implied. See the License for the | |
18 * specific language governing permissions and limitations | |
19 * under the License. | |
20 * | |
21 */ | |
22 | |
23 | |
24 import java.lang.management.ManagementFactory; | |
25 import javax.management.MBeanServer; | |
26 import javax.management.ObjectName; | |
27 | |
28 public class AbstractCache | |
29 { | |
30 static void registerMBean(Object cache, String table, String name) | |
31 { | |
32 MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); | |
33 try | |
34 { | |
35 String mbeanName = "org.apache.cassandra.db:type=Caches,keyspace=" + table + ",cache=" + name; | |
36 mbs.registerMBean(cache, new ObjectName(mbeanName)); | |
37 } | |
38 catch (Exception e) | |
39 { | |
40 throw new RuntimeException(e); | |
41 } | |
42 } | |
43 } |