Permalink
Comparing changes
Open a pull request
- 8 commits
- 43 files changed
- 0 commit comments
- 2 contributors
Commits on Apr 24, 2019
Commits on Apr 28, 2019
WFLY-11854 Distributable session manager cannot detect immutable external classes
Unified
Split
Showing
with
1,350 additions
and 306 deletions.
- +107 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/CompositeIterable.java
- +69 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/CompositeIterator.java
- +31 −172 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/Immutability.java
- +45 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/AnnotationImmutability.java
- +34 −19 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/{ → immutable}/CollectionImmutability.java
- +56 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/CompositeImmutability.java
- +155 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/DefaultImmutability.java
- +51 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/IdentityImmutability.java
- +46 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/InstanceOfImmutability.java
- +73 −0 clustering/ee/spi/src/main/java/org/wildfly/clustering/ee/immutable/SimpleImmutability.java
- +61 −0 clustering/ee/spi/src/test/java/org/wildfly/clustering/ee/CompositeIterableTestCase.java
- +9 −5 clustering/ee/spi/src/test/java/org/wildfly/clustering/ee/{ → immutable}/ImmutabilityTestCase.java
- +8 −0 ...java/org/wildfly/extension/clustering/web/deployment/DistributableWebDeploymentConfiguration.java
- +7 −0 ...rg/wildfly/extension/clustering/web/deployment/DistributableWebDeploymentDependencyProcessor.java
- +53 −7 ...ain/java/org/wildfly/extension/clustering/web/deployment/DistributableWebDeploymentXMLReader.java
- +16 −1 .../org/wildfly/extension/clustering/web/deployment/MutableDistributableDeploymentConfiguration.java
- +47 −26 clustering/web/extension/src/main/resources/schema/distributable-web_1_0.xsd
- +9 −0 .../org/wildfly/extension/clustering/web/deployment/DistributableWebDeploymentXMLReaderTestCase.java
- +4 −1 ...sion/src/test/resources/org/wildfly/extension/clustering/web/deployment/distributable-web-1.0.xml
- +2 −0 ...st/resources/org/wildfly/extension/clustering/web/deployment/distributable-web-infinispan-1.0.xml
- +4 −2 .../src/main/java/org/wildfly/clustering/web/infinispan/session/InfinispanSessionManagerFactory.java
- +6 −0 ...wildfly/clustering/web/infinispan/session/InfinispanSessionManagerFactoryServiceConfigurator.java
- +5 −3 ...n/src/main/java/org/wildfly/clustering/web/infinispan/session/coarse/CoarseSessionAttributes.java
- +5 −2 ...ain/java/org/wildfly/clustering/web/infinispan/session/coarse/CoarseSessionAttributesFactory.java
- +6 −4 ...ispan/src/main/java/org/wildfly/clustering/web/infinispan/session/fine/FineSessionAttributes.java
- +5 −2 ...rc/main/java/org/wildfly/clustering/web/infinispan/session/fine/FineSessionAttributesFactory.java
- +2 −0 .../spi/src/main/java/org/wildfly/clustering/web/session/DistributableSessionManagementProvider.java
- +13 −34 ...tering/web/spi/src/main/java/org/wildfly/clustering/web/session/SessionAttributeImmutability.java
- +3 −0 .../web/spi/src/main/java/org/wildfly/clustering/web/session/SessionManagerFactoryConfiguration.java
- +14 −8 ...eb/spi/src/test/java/org/wildfly/clustering/web/session/SessionAttributeImmutabilityTestCase.java
- +4 −1 .../web/undertow/src/main/java/org/wildfly/clustering/web/undertow/session/DistributableSession.java
- +3 −2 ...ildfly/clustering/web/undertow/session/DistributableSessionManagerFactoryServiceConfigurator.java
- +18 −1 ...n/java/org/wildfly/clustering/web/undertow/session/SessionManagerFactoryConfigurationAdapter.java
- +5 −2 ...a/org/wildfly/clustering/web/undertow/session/UndertowDistributableSessionManagementProvider.java
- +17 −8 ...undertow/session/{ImmutableAuthenticatedSession.java → UndertowSessionAttributeImmutability.java}
- +7 −1 ...in/java/org/wildfly/clustering/web/undertow/session/UndertowSessionManagementProviderFactory.java
- +17 −4 docs/src/main/asciidoc/_high-availability/subsystem-support/Distributable_Web_Applications.adoc
- +169 −0 .../src/test/java/org/jboss/as/test/clustering/cluster/web/AbstractImmutableWebFailoverTestCase.java
- +74 −0 ...ng/src/test/java/org/jboss/as/test/clustering/cluster/web/CoarseImmutableWebFailoverTestCase.java
- +74 −0 ...ring/src/test/java/org/jboss/as/test/clustering/cluster/web/FineImmutableWebFailoverTestCase.java
- +7 −0 ...ing/src/test/java/org/jboss/as/test/clustering/cluster/web/distributable-web_immutable_coarse.xml
- +7 −0 ...ering/src/test/java/org/jboss/as/test/clustering/cluster/web/distributable-web_immutable_fine.xml
- +2 −1 ...e/integration/clustering/src/test/java/org/jboss/as/test/clustering/single/web/SimpleServlet.java
| @@ -0,0 +1,107 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.wildfly.clustering.ee; | ||
|
|
||
| import java.util.List; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.Iterator; | ||
|
|
||
| /** | ||
| * Used for iterating over an series of iterables, thus avoiding the need to allocate/populate a new list containing all elements. | ||
| * More efficient than the alternative when the number of iterables is arbitrary and small relative to the size of each iterable. | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CompositeIterable<T> implements Iterable<T> { | ||
|
|
||
| private final List<? extends Iterable<? extends T>> iterables; | ||
|
|
||
| /** | ||
| * Constructs a new composite iterable. | ||
| * @param iterables a series of iterables | ||
| */ | ||
| @SafeVarargs | ||
| public CompositeIterable(Iterable<? extends T>... iterables) { | ||
| this(Arrays.asList(iterables)); | ||
| } | ||
|
|
||
| /** | ||
| * Constructs a new composite iterable. | ||
| * @param iterables a series of iterables | ||
| */ | ||
| public CompositeIterable(List<? extends Iterable<? extends T>> iterables) { | ||
| this.iterables = iterables; | ||
| } | ||
|
|
||
| @Override | ||
| public Iterator<T> iterator() { | ||
| List<Iterator<? extends T>> iterators = new ArrayList<>(this.iterables.size()); | ||
| for (Iterable<? extends T> elements : this.iterables) { | ||
| iterators.add(elements.iterator()); | ||
| } | ||
| return new CompositeIterator<>(iterators); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int result = 1; | ||
| for (Iterable<? extends T> elements : this.iterables) { | ||
| for (T element : elements) { | ||
| result = 31 * result + ((element != null) ? element.hashCode() : 0); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| if (!(object instanceof Iterable)) return false; | ||
| @SuppressWarnings("unchecked") | ||
| Iterator<Object> otherElements = ((Iterable<Object>) object).iterator(); | ||
| for (Iterable<? extends T> iterable : this.iterables) { | ||
| Iterator<? extends T> elements = iterable.iterator(); | ||
| while (elements.hasNext() && otherElements.hasNext()) { | ||
| elements.next().equals(otherElements.next()); | ||
| } | ||
| if (elements.hasNext()) return false; | ||
| } | ||
| return !otherElements.hasNext(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| StringBuilder builder = new StringBuilder(); | ||
| builder.append('['); | ||
| Iterator<? extends Iterable<? extends T>> iterables = this.iterables.iterator(); | ||
| while (iterables.hasNext()) { | ||
| Iterator<? extends T> elements = iterables.next().iterator(); | ||
| while (elements.hasNext()) { | ||
| if (builder.length() > 1) { | ||
| builder.append(',').append(' '); | ||
| } | ||
| builder.append(elements.next()); | ||
| } | ||
| } | ||
| return builder.append(']').toString(); | ||
| } | ||
| } |
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2019, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.wildfly.clustering.ee; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Iterator; | ||
| import java.util.NoSuchElementException; | ||
|
|
||
| /** | ||
| * Iterator that iterates over a series of iterators. | ||
| * @author Paul Ferraro | ||
| */ | ||
| public class CompositeIterator<E> implements Iterator<E> { | ||
|
|
||
| private final Iterable<? extends Iterator<? extends E>> iterators; | ||
|
|
||
| /** | ||
| * Constructs a new composite iterator. | ||
| * @param iterables a series of iterators | ||
| */ | ||
| @SafeVarargs | ||
| public CompositeIterator(Iterator<? extends E>... iterators) { | ||
| this(Arrays.asList(iterators)); | ||
| } | ||
|
|
||
| /** | ||
| * Constructs a new composite iterator. | ||
| * @param iterables a series of iterators | ||
| */ | ||
| public CompositeIterator(Iterable<? extends Iterator<? extends E>> iterators) { | ||
| this.iterators = iterators; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean hasNext() { | ||
| for (Iterator<? extends E> iterator : this.iterators) { | ||
| if (iterator.hasNext()) return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public E next() { | ||
| for (Iterator<? extends E> iterator : this.iterators) { | ||
| if (iterator.hasNext()) return iterator.next(); | ||
| } | ||
| throw new NoSuchElementException(); | ||
| } | ||
| } |
Oops, something went wrong.