Changes for scalagen.
This commit is contained in:
parent
e7649b44cb
commit
1c345dae8a
6 changed files with 46 additions and 6 deletions
22
COPYRIGHT
Normal file
22
COPYRIGHT
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright (C) 2019, Stasis Software Systems, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Please see the LICENSE file included in the top-level directory of this
|
||||||
|
* project for additional information.
|
||||||
|
*/
|
10
NOTES
10
NOTES
|
@ -10,4 +10,14 @@
|
||||||
* Jepsen
|
* Jepsen
|
||||||
* Nested transactions
|
* Nested transactions
|
||||||
|
|
||||||
|
* Scalagen
|
||||||
|
* <> -> typed
|
||||||
|
* exceptions multi-catch, separate
|
||||||
|
* try with resources, use finally
|
||||||
|
* //, /*- and /* comment don't migrate
|
||||||
|
* enum classes
|
||||||
|
* multiple private constructors
|
||||||
|
* @BeanProperty
|
||||||
|
* copyright
|
||||||
|
|
||||||
* http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html
|
* http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html
|
||||||
|
|
|
@ -139,13 +139,16 @@ public class RestoreMarker {
|
||||||
SingleItemEntry.create(LogEntryType.LOG_RESTORE_REQUIRED, rr);
|
SingleItemEntry.create(LogEntryType.LOG_RESTORE_REQUIRED, rr);
|
||||||
ByteBuffer buf2 = logManager.putIntoBuffer(marker, 0);
|
ByteBuffer buf2 = logManager.putIntoBuffer(marker, 0);
|
||||||
|
|
||||||
try (FileOutputStream stream = new FileOutputStream(lastFile);
|
FileOutputStream stream = new FileOutputStream(lastFile);
|
||||||
FileChannel channel = stream.getChannel()) {
|
FileChannel channel = stream.getChannel();
|
||||||
|
try {
|
||||||
channel.write(buf1);
|
channel.write(buf1);
|
||||||
channel.write(buf2);
|
channel.write(buf2);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
/* the stream and channel will be closed */
|
/* the stream and channel will be closed */
|
||||||
throw e;
|
throw e;
|
||||||
|
} finally {
|
||||||
|
channel.close();
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new FileCreationException(
|
throw new FileCreationException(
|
||||||
|
|
|
@ -86,8 +86,13 @@ abstract class BaseEntry<T extends Loggable> implements LogEntry {
|
||||||
final Constructor<T> noArgsConstructor) {
|
final Constructor<T> noArgsConstructor) {
|
||||||
try {
|
try {
|
||||||
return noArgsConstructor.newInstance((Object[]) null);
|
return noArgsConstructor.newInstance((Object[]) null);
|
||||||
} catch (IllegalAccessException | InstantiationException |
|
} catch (IllegalAccessException e) {
|
||||||
IllegalArgumentException | InvocationTargetException e) {
|
throw EnvironmentFailureException.unexpectedException(e);
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
throw EnvironmentFailureException.unexpectedException(e);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw EnvironmentFailureException.unexpectedException(e);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
throw EnvironmentFailureException.unexpectedException(e);
|
throw EnvironmentFailureException.unexpectedException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ public class LNLogEntry<T extends LN> extends BaseReplicableEntry<T> {
|
||||||
* @return the log entry
|
* @return the log entry
|
||||||
*/
|
*/
|
||||||
public static <T extends LN> LNLogEntry<T> create(final Class<T> cls) {
|
public static <T extends LN> LNLogEntry<T> create(final Class<T> cls) {
|
||||||
return new LNLogEntry<>(cls);
|
return new LNLogEntry<T>(cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructor to read an entry. */
|
/* Constructor to read an entry. */
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class NameLNLogEntry extends LNLogEntry<NameLN> {
|
||||||
@Override
|
@Override
|
||||||
public Collection<VersionedWriteLoggable> getEmbeddedLoggables() {
|
public Collection<VersionedWriteLoggable> getEmbeddedLoggables() {
|
||||||
final Collection<VersionedWriteLoggable> list =
|
final Collection<VersionedWriteLoggable> list =
|
||||||
new ArrayList<>(super.getEmbeddedLoggables());
|
new ArrayList<VersionedWriteLoggable>(super.getEmbeddedLoggables());
|
||||||
list.addAll(Arrays.asList(
|
list.addAll(Arrays.asList(
|
||||||
new NameLN(), DbOperationType.NONE,
|
new NameLN(), DbOperationType.NONE,
|
||||||
new ReplicatedDatabaseConfig()));
|
new ReplicatedDatabaseConfig()));
|
||||||
|
|
Loading…
Reference in a new issue