forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[transaction-coordinator] Ownership change listeners (apache#5457)
### Motivation This is the first part to implement transaction coordinator startup, this PR added ownership change listeners, using the ownership change listeners can get namespace bundle/topics is owned or unload by this broker. transaction coordinator can add listeners to create transaction coordinator instance, also some other component can use it to get the change event of ownership. ### Modifications Add namespace bundle ownership listener Add topic ownership listener
- Loading branch information
1 parent
df19f26
commit 025f99a
Showing
5 changed files
with
313 additions
and
12 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...er/src/main/java/org/apache/pulsar/broker/namespace/NamespaceBundleOwnershipListener.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,41 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF 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.apache.pulsar.broker.namespace; | ||
|
||
import org.apache.pulsar.common.naming.NamespaceBundle; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* Listener for <code>NamespaceBundle</code> ownership changes | ||
*/ | ||
public interface NamespaceBundleOwnershipListener extends Predicate<NamespaceBundle> { | ||
|
||
/** | ||
* Will be call after a <code>NamespaceBundle</code> owned by broker | ||
* @param bundle owned bundle | ||
*/ | ||
void onLoad(NamespaceBundle bundle); | ||
|
||
/** | ||
* Will be call after a <code>NamespaceBundle</code> unloaded from broker | ||
* @param bundle owned bundle | ||
*/ | ||
void unLoad(NamespaceBundle bundle); | ||
} |
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
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.