Skip to content

Commit

Permalink
[hotfix] Make NoOpTransientBlobService a public testing class
Browse files Browse the repository at this point in the history
  • Loading branch information
tillrohrmann committed Apr 24, 2020
1 parent e48fac8 commit 5cfa396
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.flink.runtime.blob;

import org.apache.flink.api.common.JobID;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

/**
* No-op implementation of {@link TransientBlobService}.
*/
public enum NoOpTransientBlobService implements TransientBlobService {
INSTANCE;

@Override
public File getFile(TransientBlobKey key) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public File getFile(JobID jobId, TransientBlobKey key) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(byte[] value) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(JobID jobId, byte[] value) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(InputStream inputStream) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(JobID jobId, InputStream inputStream) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public boolean deleteFromCache(TransientBlobKey key) {
throw new UnsupportedOperationException();
}

@Override
public boolean deleteFromCache(JobID jobId, TransientBlobKey key) {
throw new UnsupportedOperationException();
}

@Override
public void close() throws IOException {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@

package org.apache.flink.runtime.rest.util;

import org.apache.flink.api.common.JobID;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.JobManagerOptions;
import org.apache.flink.configuration.RestOptions;
import org.apache.flink.runtime.blob.TransientBlobKey;
import org.apache.flink.runtime.blob.TransientBlobService;
import org.apache.flink.runtime.blob.NoOpTransientBlobService;
import org.apache.flink.runtime.dispatcher.DispatcherGateway;
import org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint;
import org.apache.flink.runtime.leaderelection.LeaderContender;
Expand All @@ -43,9 +41,7 @@

import javax.annotation.Nonnull;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -129,53 +125,4 @@ public void onFatalError(final Throwable exception) {
}
}

/**
* No-op implementation of {@link TransientBlobService}.
*/
private enum NoOpTransientBlobService implements TransientBlobService {
INSTANCE;

@Override
public File getFile(TransientBlobKey key) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public File getFile(JobID jobId, TransientBlobKey key) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(byte[] value) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(JobID jobId, byte[] value) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(InputStream inputStream) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public TransientBlobKey putTransient(JobID jobId, InputStream inputStream) throws IOException {
throw new UnsupportedOperationException();
}

@Override
public boolean deleteFromCache(TransientBlobKey key) {
throw new UnsupportedOperationException();
}

@Override
public boolean deleteFromCache(JobID jobId, TransientBlobKey key) {
throw new UnsupportedOperationException();
}

@Override
public void close() throws IOException {}
}
}

0 comments on commit 5cfa396

Please sign in to comment.