-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae74a42
commit 7a3d45c
Showing
7 changed files
with
495 additions
and
79 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ore/src/main/java/org/apache/geode/internal/cache/wan/MutableGatewaySenderAttributes.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,26 @@ | ||
/* | ||
* 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.geode.internal.cache.wan; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import org.apache.geode.cache.wan.GatewaySender.OrderPolicy; | ||
|
||
public interface MutableGatewaySenderAttributes extends GatewaySenderAttributes { | ||
|
||
void setOrderPolicy(@Nullable OrderPolicy orderPolicy); | ||
|
||
} |
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
37 changes: 37 additions & 0 deletions
37
geode-wan/src/main/java/org/apache/geode/cache/wan/internal/GatewaySenderTypeFactory.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,37 @@ | ||
/* | ||
* 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.geode.cache.wan.internal; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import org.apache.geode.cache.wan.GatewaySender; | ||
import org.apache.geode.internal.cache.InternalCache; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderAttributes; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderException; | ||
import org.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes; | ||
import org.apache.geode.internal.statistics.StatisticsClock; | ||
|
||
public interface GatewaySenderTypeFactory { | ||
|
||
void validate(@NotNull MutableGatewaySenderAttributes attributes) throws GatewaySenderException; | ||
|
||
GatewaySender create(@NotNull InternalCache cache, @NotNull StatisticsClock clock, | ||
@NotNull GatewaySenderAttributes attributes); | ||
|
||
GatewaySender createCreation(@NotNull InternalCache cache, | ||
@NotNull GatewaySenderAttributes attributes); | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...n/java/org/apache/geode/cache/wan/internal/parallel/ParallelGatewaySenderTypeFactory.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,55 @@ | ||
/* | ||
* 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.geode.cache.wan.internal.parallel; | ||
|
||
import static java.lang.String.format; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import org.apache.geode.cache.wan.GatewaySender; | ||
import org.apache.geode.cache.wan.internal.GatewaySenderTypeFactory; | ||
import org.apache.geode.internal.cache.InternalCache; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderAttributes; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderException; | ||
import org.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes; | ||
import org.apache.geode.internal.cache.xmlcache.ParallelGatewaySenderCreation; | ||
import org.apache.geode.internal.statistics.StatisticsClock; | ||
|
||
public class ParallelGatewaySenderTypeFactory implements GatewaySenderTypeFactory { | ||
@Override | ||
public void validate(final @NotNull MutableGatewaySenderAttributes attributes) | ||
throws GatewaySenderException { | ||
if ((attributes.getOrderPolicy() != null) | ||
&& attributes.getOrderPolicy().equals(GatewaySender.OrderPolicy.THREAD)) { | ||
throw new GatewaySenderException( | ||
format("Parallel Gateway Sender %s can not be created with OrderPolicy %s", | ||
attributes.getId(), attributes.getOrderPolicy())); | ||
} | ||
} | ||
|
||
@Override | ||
public GatewaySender create(final @NotNull InternalCache cache, | ||
final @NotNull StatisticsClock clock, | ||
final @NotNull GatewaySenderAttributes attributes) { | ||
return new ParallelGatewaySenderImpl(cache, clock, attributes); | ||
} | ||
|
||
@Override | ||
public GatewaySender createCreation(final @NotNull InternalCache cache, | ||
final @NotNull GatewaySenderAttributes attributes) { | ||
return new ParallelGatewaySenderCreation(cache, attributes); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
.../main/java/org/apache/geode/cache/wan/internal/serial/SerialGatewaySenderTypeFactory.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,68 @@ | ||
/* | ||
* 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.geode.cache.wan.internal.serial; | ||
|
||
import static java.lang.String.format; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import org.apache.geode.cache.wan.GatewaySender; | ||
import org.apache.geode.cache.wan.internal.GatewaySenderTypeFactory; | ||
import org.apache.geode.internal.cache.InternalCache; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderAttributes; | ||
import org.apache.geode.internal.cache.wan.GatewaySenderException; | ||
import org.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes; | ||
import org.apache.geode.internal.cache.xmlcache.SerialGatewaySenderCreation; | ||
import org.apache.geode.internal.statistics.StatisticsClock; | ||
|
||
public class SerialGatewaySenderTypeFactory implements GatewaySenderTypeFactory { | ||
@Override | ||
public void validate(final @NotNull MutableGatewaySenderAttributes attributes) | ||
throws GatewaySenderException { | ||
|
||
if (!attributes.getAsyncEventListeners().isEmpty()) { | ||
throw new GatewaySenderException( | ||
format( | ||
"SerialGatewaySender %s cannot define a remote site because at least AsyncEventListener is already added. Both listeners and remote site cannot be defined for the same gateway sender.", | ||
attributes.getId())); | ||
} | ||
|
||
if (attributes.mustGroupTransactionEvents() && attributes.getDispatcherThreads() > 1) { | ||
throw new GatewaySenderException( | ||
format( | ||
"SerialGatewaySender %s cannot be created with group transaction events set to true when dispatcher threads is greater than 1", | ||
attributes.getId())); | ||
} | ||
|
||
if (attributes.getOrderPolicy() == null && attributes.getDispatcherThreads() > 1) { | ||
attributes.setOrderPolicy(GatewaySender.DEFAULT_ORDER_POLICY); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public GatewaySender create(final @NotNull InternalCache cache, | ||
final @NotNull StatisticsClock clock, | ||
final @NotNull GatewaySenderAttributes attributes) { | ||
return new SerialGatewaySenderImpl(cache, clock, attributes); | ||
} | ||
|
||
@Override | ||
public GatewaySender createCreation(final @NotNull InternalCache cache, | ||
final @NotNull GatewaySenderAttributes attributes) { | ||
return new SerialGatewaySenderCreation(cache, attributes); | ||
} | ||
} |
Oops, something went wrong.